Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT

Problem: Compute the sum of the digits of the number 2^20 × 5^18 written in decimal.

  1. A. 5
  2. B. 3
  3. C. 6
  4. D. 4

Correct answer: D. 4

Since 2^20 × 5^18 = 2² × 10^18, its decimal form is 4 followed by 18 zeros, so the digit sum is 4. Multiplying out small pieces without simplifying works but invites arithmetic slips.

More Coding Interview Problems questions

Exams that ask this topic