How to use write* without \n symbol?

I need to display matrix of numbers, and whenever i use write* or print* it just cascades down the console line like that
1
2
3
4
5
But i need it to display without \n symbol automatically inserting itself after every number
1 2 3
4 5 6
7 8 9
Any ideas?

See formatted output, e. g.

Write(*, '(3i0)') list

This is a big topic, but the formatting available is very powerful, I suggest you have a read and come back with more specific questions if (when?) you need more help

1 Like

write accepts an option advance='no' with formatted output.

program main
implicit none
integer :: i

do i=1,9
  write(*,'(i0,x)',advance='no')i
  if(mod(i,3)==0) write(*,*)''
enddo

end program

which outputs

1 2 3
4 5 6
7 8 9
3 Likes

Thanks a lot!