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 .
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 T lines containing the Sum of Digits of the numbers .
use no. as a stringLast edit: 2021-03-04 17:49:57
Im using int for the number and the output is correct,why i have WA in SPOJ?
Showing success in ideoneit but wrong answer while running judge...
In java use string to solve by using charAt to get elements from string
you can solve it using string normally..just calculate the sum of all charecters of the string :)
Not for Java or Scala. You will always get TLE .
Use STL string....
ac in one go haha sooooooooooo
AC in one go :)
java TLE :(