Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
algorithms for Determine the sum of al digits of n
yethu
Programming language:
Python
2021-07-06 01:02:28
0
Q:
algorithms for Determine the sum of al digits of n
Levyce
Code:
Python
2021-07-20 01:21:31
def sum_of_digits(n): sum = 0 while (n != 0): sum = sum + int(n % 10) n = int(n/10) return sum
1
Tags
digits
sum
digit
Related
sum every ith element numpy
python algorithm that takes a list of numbers and calculates the sum of the square of each number
sum of digits python recursive
New to Communities?
Join the community