4. Short answer type questions.
Consider the given program and answer the following questions.
sum = 0
For N = 1 TO 30 Step 2
sum = sum + N
EndFor TextWindow.WriteLine("sum=" + sum)
(i) How many times the above loop will run?
(ii) What will be the output of the above program?
(iii) Explain infinite loop with the help of example.
(iv) Explain the syntax of For... EndFor loop statement.
Answers
Answered by
4
Answer:
Consider the given program and answer the following questions.
sum = 0
For N = 1 TO 30 Step 2
sum = sum + N
EndFor TextWindow.WriteLine("sum=" + sum)
Answered by
1
In Java, there are three kinds of loops which are – the for loop, the while loop, and the do-while loop. All these three loop constructs of Java executes a set of repeated statements as long as a specified condition remains true. This particular condition is generally known as loop control.
Similar questions