csc-python-solutions/16/3 - Digital Sum.py

6 lines
95 B
Python
Raw Normal View History

2021-02-17 11:49:28 +00:00
def digitalSum(n):
if n < 10:
return n
else:
return digitalSum(n//10) + n%10