0 votes
101 views
in Python Programming (SBLC) by (420 points)
edited
Write a Python program to get the Fibonacci series between 0 to 50.

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer

n=int(input("Enter the length of fibonacci series : "))

a=0
b=1
print("Series : ")
for i in range(n):
    if n<0:
        print("Invalid input")
    
    elif n==0:
        print(0)
    
    elif n==1:
        print(1)

    else:
        c=a+b
        a=b
        b=c
        print(b)
 

Related questions

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

554 users

...