You are on page 1of 1

#fibonacci series

num=int(input('enter no. of terms: '))


a=0
b=1
count=0
#Check if the number entered is valid or not
if num<=0:
print("pls enter a positve number")
#if there is single term
elif num==1:
print("fibonacci series upto ",num,' is ',a,end='')
#fibonacci sequence
else:
while count<num:
print(a)
c=a+b
#upadating the values
a=b
b=c
count+=1

You might also like