# Write a Python program to get the Fibonacci series between 0 to 50.

more_vert

Write a Python program to get the Fibonacci series between 0 to 50.

more_vert
a,b=0,1

while b<50:
print(b)
a,b= b,a+b

more_vert
n=int(input("Enter the length of fibonacci series : "))

a=0
b=1
print("Series : ")
for i in range(n):
if n<0:
print("Invalid input")

elif n==0:
print(0)

elif n==1:
print(1)

else:
c=a+b
a=b
b=c
print(b)