Dsa
Recursion
Warm-up
Fibonacci Series
Implement a program that calculates the n-th Fibonacci number using recursion. The Fibonacci sequence is defined as follows: F(0) = 0, F(1) = 1, F(n) = F(n-1) + F(n-2) for n > 1.
Input format:
- A single integer n (0 <= n <= 30).
Output format:
- Print the n-th Fibonacci number.
Example:
Input:
5
Output:
5
Key concepts
recursionmath
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now