- Asked 5/16
- 2074 Chaitra · 2 marks
- 2073 Shrawan · 5 marks
- 2070 Asar · 2 marks
- 2069 Asar · 2 marks
- 2068 Shrawan · 2 marks
Structure of a FORTRAN program
Short answer
A FORTRAN program (fixed form) has optional PROGRAM statement, specification (INTEGER, REAL, etc.), executable statements, optional STOP, and mandatory END. Subprograms follow. Columns 1-5 for labels, 6 continuation, 7-72 code, 73-80 ignored.
Explain the structure of a FORTRAN program.
A FORTRAN (FORTRAN 77) program is made of statements written in a fixed layout. It has the following structure:
- Program heading (optional):
PROGRAM name. - Specification (declaration) statements:
INTEGER,REAL,DOUBLE PRECISION,CHARACTER,LOGICAL,DIMENSION,PARAMETER. These come before any executable statement. - Executable statements: assignment, input/output (
READ,WRITE,PRINT), control (IF,DO,GOTO) and calls. STOP(optional) to end execution, andEND, which must be the last statement.- Subprograms (functions and subroutines) may follow the main program, each with its own
END.
Layout rules (fixed form)
| Columns | Use |
|---|---|
| 1 | C or * here makes the line a comment |
| 1-5 | Statement label (number) |
| 6 | Any character except 0 or blank: continuation of the previous line |
| 7-72 | The statement |
| 73-80 | Ignored (used for sequence numbers) |
Example
C AREA OF A CIRCLE
PROGRAM CIRCLE
REAL R, A
PARAMETER (PI = 3.14159)
READ *, R
A = PI * R * R
PRINT *, 'AREA = ', A
STOP
END
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Declaration vs definition; C program structure · Computer Programming, chapter 3
- Sort array ascending in FORTRAN · Computer Programming, chapter 11 · asked 2×
- Quadratic equation roots in FORTRAN · Computer Programming, chapter 11 · asked 2×
- FORTRAN characteristics; compute π · Computer Programming, chapter 11
- Largest of n numbers in FORTRAN · Computer Programming, chapter 11
- Add and subtract matrices in FORTRAN · Computer Programming, chapter 11
- Program for RK-4 first order IVP · Numerical Method, chapter 6
- Program for RK-4 second order IVP · Numerical Method, chapter 6
- FFT algorithm and program · Computational Techniques in Civil Engineering, chapter 2
- Program for alternate depths in rectangular channel · Hydraulics, chapter 7