ProgrammingHard

int c = 0; for (int i = 0; i < 3; i++) for (int j = 0; j < i; j++) printf("x"), c++; printf("%d", c); What is printed?

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

Correct answer: B. 3

For i = 0 nothing runs, for i = 1 one x is printed and for i = 2 two more, giving 3 in total.

More C Programming questions

Exams that ask this topic