Using For loop
In [1]:
n = int(input("Please enter the positive length : "))
num1 = 0
num2 = 1
print("Fabonacci Series:")
for i in range(n):
print(num1)
next_number = num1 + num2
num1,num2 = num2,next_number
In this program, the user is asked to input the length of the series. Then, a for loop is used to print the series by adding and swapping the numbers.