- 2
Program to find the addtion of digits of a number
5 Antworten
+ 3
What is "addition of digits", and your question?
+ 1
If you take the number % 10, you will get the first digit of the number.
Then, you can add thay digit to the sum.
Once that's done you can move to the next digit by dividing the number by 10.
loop/repeat what I said above until the number is less than 1 (or equal to 0), and you've added all the digits!
0
for example.. consider this number 648
i need the output to be 6+4+8=18
0
can write a proram fr that
0
Hello. My shot to get this result. It is in Python but that's easy to implement in any language.
https://code.sololearn.com/c5b5lR2oz98r/?ref=app