ProgrammingModerate

int x = 0; while (x < 3) x = x + 1; printf("%d", x); What is printed?

  1. A. 2
  2. B. 3
  3. C. 4
  4. D. 0

Correct answer: B. 3

The loop stops as soon as x is 3, so the printed value is 3.

More C Programming questions

Exams that ask this topic