FORTRAN Reference Manual
Language Elements
FORTRAN Reference Manual—528615-001
2-5
Treatment of Blanks in a Program Line
Example 2-1. Sample FORTRAN Program: Program Lines
C This program converts Fahrenheit to Celsius.
C
C It reads an initial Fahrenheit value (i), a terminal
C Fahrenheit value (j), and an increment value (k) from the
C terminal. Then it prints a table showing the
C corresponding Celsius values.
C
C Set up table for titles, headings, and entries
?SYNTAX
?LIST, CODE
 PROGRAM conversion
 WRITE (6,50)
 WRITE (6,60)
50 FORMAT (x,'TABLE SHOWING TEMPERATURE CONVERSION FROM
 + FAHRENHEIT TO CELSIUS')
60 FORMAT (5X, 'Fahrenheit', 4X, 'Celsius')
70 FORMAT (5X, I4, 10X, F6.2)
C Set up double loop: inner for computation of Celsius
C temperature, outer to supply values for I, J, and K.
 DO 200 kount = 1,2
 READ *, i, j, k
 DO 100 fahrenheit = i, j, k
 celsius = 5./9. * (fahrenheit - 32)
 WRITE (6, 70) fahrenheit, celsius
100 CONTINUE
200 CONTINUE
 END










