It is very simple query but I\'m not able to find the exact solution. How to break to new line when printing in Fortran?
for example
print*,\'This i
There are several ways to print two lines of output.
program foo
print *, 'This is the first line'
print *, 'This is the second line'
end program
is one way to achieve what you want. Another is to do
program foo
write(*,'(A,/,A)') 'This is the first line', 'This is the second line'
end program foo
And, yet another way
program foo
write(*,'(A)') 'A' // achar(13) // achar(10) // 'B'
end program foo
And with some compilers you can use options
program foo
write(*,'(A)') 'A\r\nB'
end program foo
Compiling with the following options yields:
$ gfortran -o z -fbackslash a.f90 && ./z
A
B