Sum of the Digits 

Write a program to print the sum of the digits from the given number

Iterate over the given number to Compute the modulus of the value of ‘num’ variable by 10. Divide the value of ‘num’ variable by 10. Compute the summation of the value of the ‘sum’ variable with the value of the ‘reminder’ variable to get the sum of the digits.

Solution:

Leave a Reply

Your email address will not be published. Required fields are marked *