ProgrammingHard

int c = 0; for (int i = 100; i >= 1; i /= 2) c++; printf("%d", c); What is printed?

  1. A. 6
  2. B. 8
  3. C. 7
  4. D. 100

Correct answer: C. 7

The values run 100, 50, 25, 12, 6, 3, 1, which is seven values before i becomes 0.

More C Programming questions

Exams that ask this topic