#K53852. Digit Sum of Factorial
Digit Sum of Factorial
Digit Sum of Factorial
Given a non-negative integer \(n\), compute the sum of the digits of \(n!\). Recall that the factorial of \(n\), denoted as \(n!\), is defined as:
\[ n! = 1 \times 2 \times 3 \times \cdots \times n \]
By convention, \(0! = 1\). Your task is to calculate the sum of all digits in the number representing \(n!\). For example, when \(n = 10\), \(10! = 3628800\) and the sum of its digits is \(3+6+2+8+8+0+0 = 27\>.
inputFormat
The input is provided via standard input (stdin) as a single line containing a non-negative integer (n).
outputFormat
Output to standard output (stdout) a single integer representing the sum of the digits of (n!).## sample
0
1