Here is a python function to find the sum of digits of a given number. Make sure that your input to the function is an integer
def sum_digits(n):
s = 0
while n:
s += n % 10
n /= 10
return s
Subscribe to our newsletter to get the latest updates to your inbox. ;-)
Your email address is safe with us!