Difficulty: Easy
Correct Answer: 4
Explanation:
Introduction / Context:
This question checks understanding of Fortran 77 DO loop semantics: initial value, terminal value, and step (increment). Correctly counting iterations prevents off-by-one errors in numerical codes.
Given Data / Assumptions:
Concept / Approach:
The loop runs with values N = N0, N0 + s, N0 + 2s, ... while N ≤ NL. Count the generated sequence elements within bounds.
Step-by-Step Solution:
Verification / Alternative check:
Use count formula for inclusive arithmetic progressions: count = floor((NL - N0)/s) + 1 = floor((10 - 1)/3) + 1 = floor(3) + 1 = 4.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
4
Discussion & Comments