Data Structures & AlgorithmsHardGATE CS · TCS NQT

What is the sum of all integers in [1, 100] whose digit sum is prime?

  1. A. 1673
  2. B. 1674
  3. C. 1672
  4. D. 1676

Correct answer: C. 1672

Compute each digit sum, check its primality (a single-digit sum of 1 is not prime), and add the qualifying numbers. The digit sum of 100 is 1, so 100 is excluded.

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

Exams that ask this topic