Write a python program to print Fibonacci series using while loop. Python code to calculate the Fibonacci sequence. For beginners, this program will print the fibonacci series number in the Python programming language. The Fibonacci sequence program is the most important program for anyone learning a new programming language.
a = int(input("How many numbers do you want? ")) n1 = 0 n2 = 1 num = 2 if a <= 0: print("enter the number") elif a == 1: print("Fibonacci series") print(n1) else: print("Fibonacci series") print(n1,",",n2,end=', ') while num < a: nth = n1 + n2 print(nth,end=' , ') n1 = n2 n2 = nth num += 1
How many numbers do you want?
0 , 1, 1 , 2 , 3