Question
Write a python script to read a number from the user and print the Fibonacci series up to that number.

Answer

n=int(input("Enter Number:"))
a,b=0,1
print(a,end=" ")
for i in range(2,n+1):
print(b,end=" ")
a,b=b,a+b

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free