01.05 · Problem
Sum From 1 to N
Return 1 + 2 + … + n. Use recursion, not a loop or the formula.
Examples
Example 1
Input: n = 4
Output: 10
1 + 2 + 3 + 4.
solulu Pro
Continue this problem with Pro
Inside: step-by-step hints · 9 hidden tests · reference solutions · code editor.
Lifetime ₹1,999 ₹999 · Launch offer
Item 5 of 44 · updated 2026-10-13