''' a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 0, 1, 1, 2, 3, 5, 8, etc. '''
n=int(input('Enter number: ')) '''Accpt number from user'''
n1=0
n2=1
print('Fibonacci series up to given number :')
print(n1, end=" ") '''print value of n1'''
print(n2,end=" ") '''print value of n2'''
n3=n1+n2
print(n3,end=" ") '''print value of n3'''
while n3<n: '''loop runs until n3 becomes less than given number(n)'''
n1=n2
n2=n3
n3=n1+n2
print(n3,end=" ")
0 Comments