0

To find the sum of all the digits of a given no.

8th Feb 2017, 10:22 AM
Subham Kumar
2 Respostas
0
Hint: use for loop and remainder operator ( % )
8th Feb 2017, 10:32 AM
Ladislav Milunović
Ladislav Milunović - avatar
0
2 logic. ...1) Use Sum=0; sum =sum+digit; 2) Digit=Num%10;(for last digit)...int Num=num/10; now change 10 to 100 ,then 100 to 1000 ...so on
8th Feb 2017, 11:38 AM
Shreyance Gupta
Shreyance Gupta - avatar