Loading, please wait...

A to Z Full Forms and Acronyms

Program to Display Fibonacci Sequence Using Recursion | Python

Mar 04, 2021 Python, 889 Views
Program to Display Fibonacci Sequence Using Recursion

Program to Display Fibonacci Sequence Using Recursion

def recur_fibo(n):
   if n <= 1:
       return n
   else:
       return(recur_fibo(n-1) + recur_fibo(n-2))

nterms = 10


if nterms <= 0:
   print("Plese enter a positive integer")
else:
   print("Fibonacci sequence:")
   for i in range(nterms):
       print(recur_fibo(i))
A to Z Full Forms and Acronyms

Related Article