Simple Sum

4.5

6 votes
Problem

Problem Statement

Given a number N, find the sum of all the digits of the number.

INPUT-

The first line contains a single integer T, denoting the number of test cases.
For each test case, a single integer N is given as input.

OUTPUT-
For each test case, print the sum of digits of the given number N.
Each output should be on a new line.

Constraints-
1<=T<=100
The number of digits in N can be between 1 to 100 inclusive.

Note-
Pay attention to the size of N, and decide the data type to store it in accordingly.

Sample Input
3
23
345
1111
Sample Output
5
12
4
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?