Data Structures & AlgorithmsModerateCAT · TCS NQT

Problem: How many integers in the range 1 to 100 are both a multiple of 3 and have a digit sum equal to 6?

  1. A. 33
  2. B. 16
  3. C. 7
  4. D. 6

Correct answer: C. 7

Digit sum 6 already forces divisibility by 3, so the answer is just 6, 15, 24, 33, 42, 51, 60: seven numbers. 33 counts all multiples of 3, 16 counts multiples of 6, and leaving out 60 gives 6.

More Coding Interview Problems questions

Exams that ask this topic