Input/Output
Programming
This program demonstrates reading input from the user and displaying output in Fortran.
Input/Output Statements
print *, "message": Outputs text to standard outputread *, variable: Reads input from standard input
The * in both statements indicates list-directed I/O, which automatically formats the input/output based on the variable type.
Implementation
program input_output
implicit none
integer :: num
print *, "Enter an integer (press enter after you type it):"
read *, num
print *, "You entered: ", num
end program input_output Example Interaction
Enter an integer (press enter after you type it):
42
You entered: 42