Multiple choice

void main() { int i; for (i=5; ++i; i-=3) printf("%d ",i); }

  1. Program Hangs

  2. No Output

  3. 6 4 2

  4. 5 2

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

The for loop initializes i=5, then checks ++i which makes i=6 (true, so loop runs), prints 6. Then i-=3 makes i=3. Check ++i: i=4 (true), prints 4. Then i-=3 makes i=1. Check ++i: i=2 (true), prints 2. Then i-=3 makes i=-1. Check ++i: i=0 (false), loop exits. Output: 6 4 2.