Python program to print Fibonacci series with the output.

fibonacii number output

Hey, internet mates here we are going to make a python program to generate the Fibonacci series up to given terms. To understand the program code of Fibonacci we first have to understand what is Fibonacci series?

The series in which the next number is found by adding up two numbers before it. The simple mathematical equation to describe it is Xn+2=Xn+1+Xn.

Below program depicts how we use different variables and functions to print the Fibonacci Series for desired range.First we define a function with three inputs x,y,z.After defining function we use if with proper condition . Outside the function we write code to ask user for the no of terms.Then we call the function for our desired result.

Program code:-
def fibo(z,x,y):
    if x>0:
        d=y+x
        print(d)
        i=d
        y=x
        x=i
        fibo(z-1,x,y)
z=int(input("Enter no:-"))
print(0)
print(1)
fibo(z-2,1,0)

Output:-

Thank You For Coming Here 🙂.

Leave a Comment

Your email address will not be published. Required fields are marked *