You can use implied DO stacks to write values as single entries. Compare the following two examples:
integer :: i
do i=1,10
write(*,'(2I4)') i, 2*i
end do
It produces:
1 2
2 4
3 6
...
Using the implied DO stacks, it can be rewritten as:
integer :: i
write(*, '(10(2I4))') (i, 2*i, i=1,10)
It produces:
1 2 2 4 3 6 ...
If the number of elements is not fixed at compile time, you can use the extension <n>(not supported gfortran):
write(*, '(<n>(2I4))') (i, 2*i, i=1,n)
(2I4) n. GNU Fortran , :
character(len=20) :: myfmt
write(myfmt, '("(",I0,"(2I4))")') n
write(*, fmt=myfmt) (i, 2*i, i=1,n)
, ( *):
write(*, *) (i, 2*i, i=1,10)