Submit | All submissions | Best solutions | Back to list |
ALCATRAZ1 - SUM OF DIGITS |
You are being given a number N. (1<=N<=10^50) . You have to print the sum of digits of that particular number.
Input
The first line will contain T, the number of testcases (T<10) . The next T lines will contain the numbers whose sum of digits you have to calculate .
Output
Output T lines containing the Sum of Digits of the numbers .
Example
Input: 3 123123123 3434 1234567890 Output: 18 14 45
Added by: | Alcatraz |
Date: | 2016-11-04 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |
hide comments
|
||||||||
2017-03-15 16:21:16
think simple... hint:use type casting |
||||||||
2017-03-11 04:05:29
Just don't use Integer Data Types. Use String and then from a loop, convert every character into an Integer an sum them all in the same loop. Hope it helps, ;). |
||||||||
2017-02-01 12:07:20
Was this even a question? Too easy.... |
||||||||
2017-01-28 08:45:20
ac in 1 go....easy...just make a char array...apply ascii application |
||||||||
2017-01-11 20:20:45
How to store such a big no. |
||||||||
2016-12-16 11:10:21
how to input (1<=N<=10^50) which data type should be used |
||||||||
2016-12-15 16:54:32
i am getting wrong answer !! i juzt used normal bruteforce to calculate !! |
||||||||
2016-11-29 18:30:24 Ishwar
accepted for first time , simple program , nothing to cheer! |