Data Structures & AlgorithmsModerateICPC regional · Amazon SDE OA

How many integers from 1 to 500 inclusive are divisible by 4 but not by 6?

  1. A. 85
  2. B. 125
  3. C. 84
  4. D. 459

Correct answer: C. 84

Multiples of 4 number 125, multiples of 12 number 41, so the answer is 125 - 41 = 84. Checking the divisibility conditions directly gives the same count.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic