ProgrammingVery hard

How many integers from 1 to 10^9 are divisible by 7 or by 11?

  1. A. 220779220
  2. B. 220779221
  3. C. 142857142
  4. D. 90909090

Correct answer: A. 220779220

Inclusion-exclusion gives floor(N/7) + floor(N/11) - floor(N/77) = 142857142 + 90909090 - 12987012 = 220779220.

More C Programming questions

Exams that ask this topic