Data Structures & AlgorithmsModerateSSC CGL Tier 2 · TCS NQT

Problem: What is the sum of the decimal digits of 9⁹?

  1. A. 0
  2. B. 27
  3. C. 45
  4. D. 9

Correct answer: C. 45

9⁹ = 387420489, whose digits sum to 45. Writing 9 ^ 9 in Python is XOR and gives 0, mixing it up with 9! = 362880 gives 27, and the digital-root shortcut only says the sum is a multiple of 9 (repeatedly summing gives 9).

More Coding Interview Problems questions

Exams that ask this topic