69. Python Program to find the Fibonacci series of a given number.
How does this program work?
- This program is used to find the Fibonacci series of a given number using Python.
- Fibonacci series means the previous two elements are added to get the next element starting with 0 and 1.
- First we initializing first and second number as 0 and 1, and print them.
- The third number will be the sum of the first two numbers by using loop.
Here is the code
n = int(input("Enter number: "))
a = 0
b = 1
c = 0
i = 2
print(a)
print(b)
while i < n:
c = a+b
a = b;
b = c;
i+=1
print(c)