Fortran 95 contains a new statement that is intended as an alternative to the Do
ID: 655915 • Letter: F
Question
Fortran 95 contains a new statement that is intended as an alternative to the Do statement. The distinguishing feature of the new statement is that the iterations of the loop may be performed in any order.
(In other words, if the values of the control variable are in the range 1 to 10, the loop might be executed in the order 3, 1, 5, 4, 7, 8, 9, 2, 10, 6 or in some other order.)
(a) Describe the general syntax of this loop.
(b) Give an example of this loop.
(c) Describe the advantage of using this kind of loop.
Explanation / Answer
The do-loop is used for simple counting. Here is a simple example that prints the cumulative sums of the integers from 1 through n (assume n has been assigned a value elsewhere):
The general form of the do loop is as follows:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.