say a number and sum the numbers from 0 code example
Example: algorithms for Determine the sum of al digits of n
def sum_of_digits(n):
sum = 0
while (n != 0):
sum = sum + int(n % 10)
n = int(n/10)
return sum
def sum_of_digits(n):
sum = 0
while (n != 0):
sum = sum + int(n % 10)
n = int(n/10)
return sum