75
Sum of Digits
To find sum of digits of a number just add all the digits.
For example,
Logic:
- Take the number.
- Divide the number by 10.
- Add the remainder to a variable.
- Repeat the process until remainder is 0.
Example:
Given program shows the sum of digits of 14597.
Output:
Next TopicEven Odd Program