Python Program to Print Fibonacci Series

Here you’ll get a python program to print Fibonacci series exploitation for a loop.

A series within which next term is obtained by adding previous 2 terms is termed Fibonacci series. as an example zero, 1, 1, 2, 3, 5, 8.

Code

num = int(input("enter number of digit you want in serie (minimum 2): "))
 
first = 0
second = 1
 
print("\nfibonacci series is:")
print(first, ",", second, end=", ")
 
for i in range(2, num):
	next = first + second
	print(next, end=", ")
 
	first = second
	second = next

Output

enter number of digit you want in serie (minimum 2): 6

fibonacci series is:
0 , 1, 1, 2, 3, 5,

Comment below if you’ve got any queries concerning on top of python Fibonacci series program.

Leave a Comment

error: Alert: Content is protected!!