Questions
Write a python program to display Fibonacci series.
Last Updated : 27 Jul 2026
Jul 22, Jan 23, Jan 23, Jul 24
Solution:
# Python program to display Fibonacci series using recursion
def fibonacci_recursive(n):
if n <= 1:
return n
return fibonacci_recursive(n - 1) + fibonacci_recursive(n - 2)
# Take input from the user
terms = int(input("Enter the number of terms: "))
if terms <= 0:
print("Please enter a positive integer.")
else:
print(f"Fibonacci series up to {terms} terms:")
for i in range(terms):
print(fibonacci_recursive(i), end=" ")
print()
Report an error