Q. Take an integer input N from the user. Print N Fibonacci numbers. Recall that Fibonacci series progresses as 0112358…..


Answer =


num = int (input ("Enter the number :- "))
a = 0
b = 1
c = 0
print (0, end = " ")
while 0 < num :
    a, b = b, c
    c = b + a
    num -= 1
    print (c, end = " ")

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post