| | Writing and Running a FORTRAN Program | |
FORTRAN Tutorials - Writing and Running a FORTRAN Program
STOP and END Statements STOP This statement may be written whenever it is necessary to stop executing statements in a program. There is normally a STOP at the end of every program. END To inform the compiler that the physical end of the source program has been reached and that no more programs statements follows.
Writing and Running a Program
 | FORTRAN code example. | Column position and there meanings | | Column # | Description | | 1-5 | Contains the statement number, if any. | | 1 | Column 1 has another function, which of indicating a comment line. If column 1 contains a C, FORTRAN does not process information on that line. (Free use of comments is encouraged to make the program more easily understandable by other programmers.) | | 6 | Use to indicate a continuation. If more than one line is required for statements, each line after the first must be start with some nonzero character in column 6. | | 7 - 72 | The statement itself is written in column 7 to 72. | | 73 & Beyond | FORTRAN does not process these columns. | |
Sample FORTRAN code
C SAMPLE PROGRAM - AREA OF A TRIANGLE
C
WRITE(6,10)
10 FORMAT(/,' ENTER THREE NUMBERS')
READ(5,25) A, B, C
25 FORMAT(3F4.2)
S=(A+B+C)/2.0
AREA=SQRT(S*(S-A)*(S-B)*(S-C))
WRITE(6,17) AREA
17 FORMAT(' AREA OF THE TRIANGLE=',F8.3)
STOP
END
| |