Sum of digits of a number using recursion
Python
Easy
recursion
Task «Sum of digits of a number using recursion»
Write a recursive function that calculates the sum of digits of a natural number. The number is given as input. Use recursion, do not use loops. It is guaranteed that the number is positive and does not exceed 10^9.
Input Format
One integer n (1 ≤ n ≤ 10^9).
Output Format
One integer — the sum of the digits of the number n.
Examples
Example 1
INPUT
123
OUTPUT
6
Example 2
INPUT
9999
OUTPUT
36
main.py