Count Down Using Recursion
Count Down Using Recursion
EasyRecursion37% accepted
Print all integers from N down to 1 using recursion — no loops allowed. This shows you how recursion can replace loops: print N first, then recursively print N-1 down to 1. The base case stops the recursion when N reaches 0.
Approach
Given N, print integers from N down to 1, each on its own line, using recursion.
Input
1
Output
1
More Recursion problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards