Sum Of Digits
Submissions: 8452   Accuracy:

57.45%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given an integer N. The task is to find sum of all digits of N.

Input:
The first line of input contains an integer T, total number of testcases. Then following T lines contains an integer N.

Output:
For each testcase in a new line, print the sum of digits of N.

Constraints:
1 ≤ T ≤ 30

1 ≤ N ≤ 103

Example:
Input:
2
123
45

Output:
6
9

Explanation:
Testcase 1:
The sum of digits the given number 123: 1 + 2 +3 = 6.

** For More Input/Output Examples Use 'Expected Output' option **

Author: shef5


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.