---
title: "DO versus implied DO loop"
subject: "Computer Programming"
chapter: 11
key: "semester_1/computer_programming:fortran-do-vs-implied-do"
source: https://www.bctengineer.com/q/semester_1/computer_programming/fortran-do-vs-implied-do
site: BCT Engineering
---

# DO versus implied DO loop

Computer Programming · Chapter 11: Programming Language: FORTRAN

- Asked in: 2072 Chaitra, 3 marks; 2072 Kartik, 4 marks; 2069 Asar, 1+1 marks (asked 3 times)
- Video: [implied do loop in fortran](https://www.youtube.com/watch?v=Jy70apW9SCQ) — Mathema Shukur  ম্যাথইমা শুকুর 
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/fortran-do-vs-implied-do
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-11

## Question

Compare DO and implied DO statement in FORTRAN. Explain with suitable example how implied do loop works in FORTRAN.

## Short answer

DO loop repeats a block of statements with a label and CONTINUE. Implied DO is a compact loop inside an I/O list( (item, var=start,end,step)), generating multiple outputs in one statement without labels, and nested implied DO processes the inner index fastest.

## Answer

#### DO loop
It repeats a block of statements a fixed number of times.

Syntax: `DO label var = start, end, step` ... `label CONTINUE`  (step is optional and is 1 by default)

```fortran
      SUM = 0
      DO 10 I = 1, 5
         SUM = SUM + I
   10 CONTINUE
```

#### Implied DO
It is a loop written in brackets inside an input/output list (or a DATA statement), without a label or CONTINUE.

Syntax: `(list, var = start, end, step)`

```fortran
      INTEGER A(5)
      READ *, (A(I), I = 1, 5)
      PRINT *, (A(I), I = 1, 5)
      PRINT *, (I*I, I = 1, 5)
```

#### Comparison

| Basis | DO | Implied DO |
|---|---|---|
| Position | A separate statement | Inside an I/O or DATA list |
| Body | Many statements | Only the list items |
| Label/CONTINUE | Needed (old style) | Not needed |
| Main use | General repetition | Reading or printing arrays |
| I/O records | A READ/PRINT inside the loop runs once per pass, so each pass starts a new record (line) | A single READ/PRINT handles all the values, so they go on one line |

#### How the implied DO works
The variable is set to the start value and the list items are processed. The variable is then increased by the step and the items are processed again, until the variable passes the end value. For `PRINT *, (I*I, I = 1, 5)` the values 1, 4, 9, 16, 25 are printed on one line. Implied DOs can be nested: in `((A(I,J), J=1,3), I=1,2)` the inner variable J runs fastest, so row 1 is processed first and then row 2.

## Check yourself

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

1. Where is an implied DO written?
   A. As a separate statement with a label
   B. Inside an I/O list or DATA statement, in brackets
   C. Only at the end of a program
   D. Only inside a subroutine
   Answer: B. An implied DO is a loop in brackets within an input/output list or DATA statement, with no label or CONTINUE. (Key point: Where implied DO is used)

2. What does PRINT *, (I*I, I = 1, 5) print?
   A. 1 2 3 4 5
   B. 1 4 9 16 25 in one line
   C. 1 4 9 16 25, each on a new line
   D. 25 only
   Answer: B. The variable runs from 1 to 5 and the values 1, 4, 9, 16, 25 are printed in a single line by one PRINT. (Key point: Output of implied DO)

3. In ((A(I,J), J=1,3), I=1,2), which variable changes fastest?
   A. I
   B. J
   C. Both together
   D. Neither
   Answer: B. The inner variable J runs fastest, so row 1 is processed first and then row 2. (Key point: Nested implied DO)

4. If a DO loop contains a PRINT statement, how does the output differ from an implied DO?
   A. There is no difference
   B. A DO loop with PRINT starts a new record (line) each pass; an implied DO gives all values in one line
   C. An implied DO prints in reverse
   D. A DO loop cannot print
   Answer: B. One READ/WRITE call per pass gives a new line each time, while an implied DO uses a single call for all values. (Key point: DO versus implied DO output)

## Related in Computer Programming

- [High level languages; C versus FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Ahll-types-c-vs-fortran) — Computer Programming, chapter 1
- [Formatted I/O in FORTRAN with syntax](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-formatted-io-syntax) — Computer Programming, chapter 11
- [Arithmetic versus logical IF](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Afortran-arithmetic-vs-logical-if) — Computer Programming, chapter 11, asked 3×
- [Break versus continue](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Abreak-vs-continue) — Computer Programming, chapter 5, asked 3×
- [do...while versus for/while loops](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Ado-while-vs-for-while) — Computer Programming, chapter 5, asked 2×

## Related in other subjects

- [Open loop versus closed loop control](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Aopen-vs-closed-loop) — Embedded System, chapter 7, asked 6×
- [Why closed loop response is faster than open loop](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Acl-faster-than-ol) — Control Systems, chapter 1, asked 4×
- [T/F: loop arrangement in urban area economical](https://www.bctengineer.com/question.md?key=semester_8%2Ftransmission_and_distribution_system_design%3Atf-loop-urban-economical) — Transmission and Distribution System Design, chapter 5
- [True/false: air conditioner is closed loop](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Atf-air-conditioning-closed) — Control Systems, chapter 1
