Data Structures & AlgorithmsHardCodeforces Div2 B · big integers

Problem: What is the digit sum of 100!? Run the code.

Problem: What is the digit sum of 100!? Run the code.
import math
print(sum(int(c) for c in str(math.factorial(100))))
What is printed?
  1. A. 648
  2. B. 594
  3. C. 621
  4. D. 500

Correct answer: A. 648

The digit sum of 100! is 648, a well-known value computed by direct big-integer arithmetic. Summing the digits of 10! or using the digit count instead gives the traps.

More Coding Interview Problems questions

Exams that ask this topic