Fibonacci Series using For Loop in Python

(Last Updated On: 11/11/2022)

In this program, we write a python program to display the Fibonacci series using the for a loop.

Python Program to Display Fibonacci Series Using for Loop

# Display Fibonacci Series using For Loop in Python

# initialize two variables, with value 0
a,b = 0,1
print(a,b,end=' ')

for i in range(18):
  c = a + b
  print(c,end = ' ')
  a = b
  b= c

Output:

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181

Leave a Reply

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