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
hide comments
sonukumar:
2021-03-04 17:49:40
use no. as a string Last edit: 2021-03-04 17:49:57 |
|
williams_sma2:
2021-01-20 03:19:49
Im using int for the number and the output is correct,why i have WA in SPOJ?
|
|
gourab13:
2020-06-23 11:34:45
Showing success in ideoneit but wrong answer while running judge... |
|
rs481441:
2020-04-02 10:15:09
In java use string to solve by using charAt to get elements from string
|
|
rahatkhan99:
2019-11-26 08:13:30
you can solve it using string normally..just calculate the sum of all charecters of the string :) |
|
vikash:
2019-10-18 07:50:25
Not for Java or Scala. You will always get TLE . |
|
importme:
2019-09-23 10:16:29
Use STL string.... |
|
light_blue:
2019-06-16 20:17:05
ac in one go haha sooooooooooo |
|
karankeswani99:
2019-01-16 16:53:16
AC in one go :)
|
|
dwzy:
2018-12-18 02:45:38
java TLE :( |
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 |