Multiple choice

How many times will the following statement be executed?void main() { int a; a=100; while(a>=100) { cout<< hello ; --a; } }

  1. Never

  2. Once

  3. 100

  4. 99

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The loop runs exactly once: a starts at 100, condition (a>=100) is true, 'hello' is printed, then --a decrements a to 99. On the next iteration, condition (99>=100) is false, so the loop exits.