Python Program to Print "n" terms of Fibonacci Series

Python Program for Fibonacci Series

Hello Friends, In this blog, you'll learn Python Program to Print "n" terms of Fibonacci Series.

This Program asks the user to input the "n" terms of number to print Fibonacci Series using Iteration.

Fibonacci Series : The Fibonacci series is a series where the next term is the sum of the previous two terms. The first two terms of the Fibonacci sequence are 0 followed by 1. 

# Write a program to print "n" terms of Fibonacci Series using Iteration.

print("How many terms of Fibonacci Series: ")
n = int(input())
a = 0
b = 1
if n >= 1:
    print(a)
if n >= 2:
    print(b)
count = 2
while count < n:
    count = count + 1
    c = a + b
    print(c)
    a = b
    b = c
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.