If I want to find the sum of the digits of a number, i.e.:
932
14
(9 + 3 + 2)
Here is a solution without any loop or recursion but works for non-negative integers only (Python3):
def sum_digits(n): if n > 0: s = (n-1) // 9 return n-9*s return 0