ProgrammingHard

How many times does a body run in for (int i = 2; i < 100; i *= i)?

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

Correct answer: B. 3

i takes 2, 4, 16 and then 256 ends the loop, so the body runs for 2, 4 and 16.

More C Programming questions

Exams that ask this topic