#K13386. Sum of Digits for Integers
Sum of Digits for Integers
Sum of Digits for Integers
Given a list of non-negative integers, compute the sum of digits for each integer. For an integer \( n \) with digits \( d_1, d_2, \ldots, d_k \), the sum is computed as \( \sum_{i=1}^{k} d_i \). For example, if \( n = 123 \), then the output is \( 1+2+3 = 6 \).
You are required to read the input from stdin
and write the output to stdout
. The first line of input contains an integer \( N \), representing the number of integers. The next line contains \( N \) space-separated non-negative integers. Output a single line containing the digit sums for each integer, separated by a space.
inputFormat
The first line contains an integer \( N \) representing the number of integers. The second line contains \( N \) space separated non-negative integers.
outputFormat
A single line containing \( N \) space-separated integers where each integer is the sum of the digits of the corresponding input number.
## sample1
123
6
</p>