#K56207. Sum of Digits
Sum of Digits
Sum of Digits
You are given a non-negative integer n. Your task is to calculate the sum of its digits. In mathematical terms, if the integer is represented as a sequence of digits \(d_1, d_2, \ldots, d_k\), you are required to compute \(\sum_{i=1}^{k} d_i\). For example, if the input is 1234
, the output should be 10
because \(1+2+3+4=10\).
The input will be provided via standard input (stdin) and the result should be printed on standard output (stdout).
inputFormat
The input consists of a single non-negative integer n
(0 \leq n
). The integer is provided in a single line via standard input.
outputFormat
Output the sum of the digits of the integer n
to standard output. The output should be a single integer which is the sum of all decimal digits of n
.
7
7