Q:

Program to Display Fibonacci Sequence Using Recursion | Python

0

Program to Display Fibonacci Sequence Using Recursion

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now