โœ๏ธ

Recursive sum

Hard๐Ÿท๏ธ Recursion๐Ÿ“‚ Algorithmic Thinking
๐Ÿงฉ The problem

Write a recursive FUNCTION SUM_TO(N) that returns 1 + 2 + โ€ฆ + N. TAKE N and DISPLAY SUM_TO(N).

Examples

  • Input: 4 โ†’ 10

โœ๏ธ Write your pseudocode

Press Run to watch it step by step, and Run tests to check it against every test case.

โ† All practice problems