
Loop Control Statements II-117
22. What is the output of the following program?
void main()
{
int nm=0;
do
{
--nm;
printf ("%d",nm);
nm++;
}
while(nm>=0);
}
(a) The loop will run infinitely. (b) The program will not be compiled.
(c) Loop will not be executed.
23. What will be the value of s after execution of the following program?
void main()
{
int i=5,a=1;
int s=0;
clrscr();
do
{s=s+a++;
} while (a<=i);
printf ("\b\bs=%d",s);
}
(a) s = 15 (b) s = 36 (c) s = 40
24. How many 'while' statements are possible in 'do-while' loop?
(a) 2 (b) 1 (c) 3 (d) None of the above
25. The for (; ;) is equivalent to .
(a) while (false) (b) while (true) (c) while (0) ...