---
title: "Structure of a FORTRAN program"
subject: "Computer Programming"
chapter: 11
key: "semester_1/computer_programming:fortran-structure"
source: https://www.bctengineer.com/q/semester_1/computer_programming/fortran-structure
site: BCT Engineering
---

# Structure of a FORTRAN program

Computer Programming · Chapter 11: Programming Language: FORTRAN

- Asked in: 2074 Chaitra, 2 marks; 2073 Shrawan, 5 marks; 2070 Asar, 2 marks; 2069 Asar, 2 marks; 2068 Shrawan, 2 marks (asked 5 times)
- Video: [Fortran program structure: Basic Elements of Fortran (Chapter-2)](https://www.youtube.com/watch?v=2-pH1iEQdHo) — FORTRAN90
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/fortran-structure
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-11

## Question

Explain the 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.

## Answer

A FORTRAN (FORTRAN 77) program is made of statements written in a fixed layout. It has the following structure:

1. **Program heading (optional):** `PROGRAM name`.
2. **Specification (declaration) statements:** `INTEGER`, `REAL`, `DOUBLE PRECISION`, `CHARACTER`, `LOGICAL`, `DIMENSION`, `PARAMETER`. These come before any executable statement.
3. **Executable statements:** assignment, input/output (`READ`, `WRITE`, `PRINT`), control (`IF`, `DO`, `GOTO`) and calls.
4. **`STOP`** (optional) to end execution, and **`END`**, which must be the last statement.
5. 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**
```text
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
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which is the correct order inside a FORTRAN 77 program?
   A. Executable statements, then declarations, then END
   B. Declarations, then executable statements, then END
   C. END, then declarations
   D. Subprograms first, then the main program
   Answer: B. Specification statements (INTEGER, REAL ...) must come before executable statements, and END is the last statement. (Key point: Order of statements)

2. In fixed-form FORTRAN, what does a character (not 0 or blank) in column 6 mean?
   A. The line is a comment
   B. The line is a statement label
   C. The line continues the previous statement
   D. The line is ignored
   Answer: C. Column 6 is the continuation column; any character except 0 or blank there marks continuation of the previous line. (Key point: Continuation line)

3. How is a line made a comment in fixed-form FORTRAN?
   A. Put a label in columns 1-5
   B. Put C or * in column 1
   C. Put a character in column 6
   D. Start it in column 73
   Answer: B. A C or * in column 1 turns the whole line into a comment. (Key point: Comment lines)

4. Where must the statement itself be written, and what happens to columns 73-80?
   A. Columns 1-5; columns 73-80 are executed
   B. Columns 7-72; columns 73-80 are ignored
   C. Columns 6-80; none are ignored
   D. Columns 7-80; columns 73-80 give labels
   Answer: B. Statements are in columns 7-72; columns 73-80 are ignored and may hold sequence numbers. (Key point: Statement columns)

## Related in Computer Programming

- [Declaration vs definition; C program structure](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Adeclaration-definition-structure-of-c) — Computer Programming, chapter 3
- [Sort array ascending in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-sort-ascending) — Computer Programming, chapter 11, asked 2×
- [Quadratic equation roots in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-quadratic-roots) — Computer Programming, chapter 11, asked 2×
- [FORTRAN characteristics; compute π](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-characteristics-pi) — Computer Programming, chapter 11
- [Largest of n numbers in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-largest-n-numbers) — Computer Programming, chapter 11
- [Add and subtract matrices in FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-matrix-add-subtract) — Computer Programming, chapter 11

## Related in other subjects

- [Program for RK-4 first order IVP](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-program-first-order) — Numerical Method, chapter 6
- [Program for RK-4 second order IVP](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Ark4-program-second-order) — Numerical Method, chapter 6
- [FFT algorithm and program](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Afft-algorithm-program) — Computational Techniques in Civil Engineering, chapter 2
- [Program for alternate depths in rectangular channel](https://www.bctengineer.com/question.md?key=semester_4%2Fhydraulics%3Aalgorithm-alternate-depths-rectangular) — Hydraulics, chapter 7
