Listed-Directed Output: The WRITE Statement

Listed-directed output is carried with the Fortran WRITE statement. The WRITE statement can display the results of a set of expressions and character strings. In general, WRITE displays the output on the screen. The WRITE statement has the following forms:
WRITE(*,*)  exp1, exp2, ..., expn

The first form starts with WRITE(*,*), followed by a list of arithmetic expressions or character strings, separated by commas. The computer will evaluate the arithmetic expressions and displays the results. Note that if a variable does not contain a value, its displayed result is unpredictable. The second form only has WRITE(*,*), which has a special meaning.

There are some useful rules:

Output Format:

There is nothing to worry about the output format. The computer will use the best way to display the results. In other words, integers and real numbers will be displayed as integers and real numbers. But, only the content of a string will be displayed. The computer will also guarantee that all significant digits will be shown so that one does not have to worry how many positions should be used for displaying a number. The consequence is that displaying a good-looking table is a challenge. This will be discussed in FORMAT statement.