Computer Science, asked by simranrose7517, 2 months ago

Find sum of digits of a number

Answers

Answered by veeraswamy708
0

Answer:

Step by step descriptive logic to find sum of digits of a given number.

Input a number from user. ...

Find last digit of the number. ...

Add last digit found above to sum i.e. sum = sum + lastDigit .

Remove last digit from number by dividing the number by 10 i.e. num = num / 10 .

Repeat step 2-4 till number becomes 0...

I hope it May helpful to you ...

Similar questions