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

Sum up to N with recursion

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

Write a recursive function total(n) — the sum of the numbers from 1 to n (total(0) = 0). Read n (0 ≤ n ≤ 1000) and print the sum.

Example

Input:

3

Output:

6

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