Given a number, 'N', find the sum of the digits of the number 'N'. For example, assume that the input number is "12345", then the sum of its digits is 15.
Input:
54871
Output:
25
Python Implementation:
Input:
54871
Output:
25
Python Implementation:
# python program to find sum of digits number = int(raw_input()) sum = 0 while number>0: sum = sum + (number % 10) number = number / 10 print sum