← Problem book: C Lesson 94 of 96 · 10 XP

Digit sum with recursion

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

Write a recursive function: the digit sum of a number = the last digit + the digit sum of the number without it. Read a non-negative number and print the sum of its digits.

Example

Input:

123

Output:

6

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.