ProgrammingHard

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

  1. A. 8
  2. B. 7
  3. C. 9
  4. D. 50

Correct answer: A. 8

The values 0 to 7 satisfy i * i <= 50, since 7 * 7 = 49 and 8 * 8 = 64. That is 8 values.

More C Programming questions

Exams that ask this topic