Fibonacci series

A sequence starts from 0 and 1 and every next number is a sum of previous two number ,its known as Fibonacci  sequence or series.

n=int(input("Enter a number to print fabonacci series upto it:"))

a=0
b=1
print(a)
print(b)
c=0
while 1:
    c=a+b
    if c<n:
        print(c)
    a=b
    b=c

 

%d bloggers like this: