Header Ads Widget

python program to print fibonacci series by recursive function

 what is fibonacci series:- 

                     In the fibonacci series every elements are the some of two elements before it.

Fibonacci Sequence = 0, 1, 1, 2, 3, 5, 8, 13, 21, ….

code:-


# function for the finding fibbo
def fib(n):
if n<=1:
return n;
return fib(n-1)+fib(n-2)
n=int(input("Enter number of elemeent in fibbo series"))
for i in range(n):
print(fib(i),end=" ")

Output:-


Enter number of element in fibbo series6
0 1 1 2 3 5



Post a Comment

0 Comments