Dsa
Recursion
Easy
Fibonacci Series Recursive
Implement a program that prints the nth Fibonacci number using recursion, where the Fibonacci sequence is defined as follows: F(n) = F(n-1) + F(n-2) with base cases F(0) = 0 and F(1) = 1. Your program should print the nth Fibonacci number for a given n.
Input Format:
- A single integer n (0 <= n <= 30).
Output Format:
- An integer representing the nth Fibonacci number.
Example:
Input:
5
Output:
5
Key concepts
recursionfibonaccisequence generation
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