Electronics and Communication Engineering - Microprocessors - Discussion
Discussion Forum : Microprocessors - Section 1 (Q.No. 31)
31.
Consider the following DO statement in Fortran 77
DO 52 N = 1, 10, 3
The number of DO loop executions in the above statement isAnswer: Option
Explanation:
Do statement is executed when N = 1, 4, 7, 10, i.e., a total of 4 times.
Discussion:
13 comments Page 1 of 2.
Urmila said:
9 years ago
Yes, Fortran(derived from "Formula Translation") 77 is a language.
Fortran 77 has only one loop construct, called the do-loop.
The do-loop is used for simple counting. expr1 specifies the initial value of var, expr2 is the terminating bound, and expr3 is the increment.
Here,
DO 52 N = 1, 10, 3.
So, 1 initial value.
10 terminating bound.
3 increment step.
So,
1 + 3 = 4.
4 + 3 = 7.
7 + 3 = 10.
Fortran 77 has only one loop construct, called the do-loop.
The do-loop is used for simple counting. expr1 specifies the initial value of var, expr2 is the terminating bound, and expr3 is the increment.
Here,
DO 52 N = 1, 10, 3.
So, 1 initial value.
10 terminating bound.
3 increment step.
So,
1 + 3 = 4.
4 + 3 = 7.
7 + 3 = 10.
(3)
Pradeep Singh said:
6 years ago
@Swathi.
It's 4 times not 3 times.
The initial number is 1 and then 3 is added to it (we get 4) , again 3 is added to 4 (we get 7), similarly the last number we get is 10 and the loop reaches its upper limit and thus ends there. Hence, the loop executes 4 times in total.
It's 4 times not 3 times.
The initial number is 1 and then 3 is added to it (we get 4) , again 3 is added to 4 (we get 7), similarly the last number we get is 10 and the loop reaches its upper limit and thus ends there. Hence, the loop executes 4 times in total.
Reetuparna Das said:
1 decade ago
What does 52 mean in between DO and N, it is definitely not a part of the instruction. The answer suggests the inclusion of 4 and 7, that too remains unexplained.
Bhavana said:
1 decade ago
Number 52 is just a label in FORTRAN 77. The logic is to continue in a loop for every sum of 3 to first element i.e. 1 and end loop if number equals to 10.
Amrata Kamat said:
1 decade ago
Can you people please explain the operation of the above problem?
Vageesha prakash said:
1 decade ago
Can someone please explain operation of fortran77?
Swathi said:
7 years ago
How it becomes 3 times @Urmila. Please clarify me.
Theja said:
7 years ago
Thank you for explaining the answer.
Adil said:
7 years ago
Thanks for your answer @Urmila.
Nagaraj said:
7 years ago
@Urmila.
Good, thanks.
Good, thanks.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers