User Forum

Subject :ICSO    Class : Class 7

What will be the output of the following program?
age = 10
DO
PRINT age
age = age + 1
LOOP WHILE age <10
A 9
B 11
C 10
D 12


how!!!

Ans 1:

Class : Class 9
The age is set as 10. Then, within the DO LOOP, it prints the age once and hence the screen displays 10. Now 'age = age + 1' and hence the new value for age is 11. But the condition for the LOOP to continue is that age should be less than 10. Since the age is 11, the LOOP stops and the program ends leaving a 10 on the screen. Hence, the answer is (C) 10.

Ans 2:

Class : Class 8
OPTION C 10 IS THE RIGHT ANSWER. CHECKED AND VERIFIED USING QBASIC APLLICATION

Post Your Answer