ProgrammingModerate

int c = 0; for (int i = 10; i > 0; i -= 3) c++; printf("%d", c); What is printed?

  1. A. 3
  2. B. 4
  3. C. 5
  4. D. 10

Correct answer: B. 4

i takes the values 10, 7, 4 and 1, and then i becomes -2 and the loop ends.

More C Programming questions

Exams that ask this topic