!----------------------------- ! ! Write an integer on screen, ! read it, and write on screen. ! !------------------------------ ! PROGRAM SIMPLE IMPLICIT NONE !- The important IMPLICIT NONE statement Integer :: i !-- Channel 6 is reserved for writing on screen and !-- channel 5 for reading from screen write(6,*) 'Please give an integer:' read(5,*)i write(6,*)'This is the integer you gave: ',i write(6,*)'It was also written in file fort.10' !-- The rest of the channels are ok. If used in the most !-- basic form as below, output goes to file fort.channel_number !-- It is also a good idea to close the channel. !-- See fortran manual for more involved I/O. write(10,*)'# Output from program simple2.f90' write(10,*)' ' write(10,*)i close(10) END PROGRAM SIMPLE