print *, 'Hello world'
integer, parameter :: i = 10 write (*, '(i2)') i
write (*, '(i2)') N
Define for preprocessed fortran
implicit none write (*, '(i2)') N
write (*, '(a4)') s
Real array as input
write (*, '(3f5.2)'), s
1.0 |
2.0 |
write (*, '(2f5.2)'), s
Real matrix as input
0.0 | 42.0 |
0.0 | 0.0 |
0.0 | 0.0 |
0.0 | 0.0 | 0.0 |
0.0 | 0.0 | 42.0 |
write (*, '(i2)'), nint(s(1,2))
write (*, '(i2)'), nint(s(2,3))
Should fail (TODO: add input variables for the case with explicit program statement)
program ex print *, "output of ex program" end program ex
Fails to compile (TODO: error check in ob-fortran.el)
print *, s
Should fail to compile with gfortran
program ex integer*8 :: i end program ex
Pass parameters to the program
character(len=255) :: cmd call get_command_argument(1, cmd) write (*,*) trim(cmd)