ProgrammingVery hard

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

  1. A. 78
  2. B. 35
  3. C. 12
  4. D. 36

Correct answer: B. 35

The sum of n / i for i from 1 to n is the harmonic-type sum, about n ln n. For n = 12 it is 35.

More C Programming questions

Exams that ask this topic