# Functions - Fibonacci series upto limit
def fn_fib(el):
n1 = -1
n2 = 1
while(True):
fib = n1 + n2
if(fib > el):
return
print(fib, end = " ")
n1, n2 = n2, fib
# Main Program
end_limit = int(input("Enter ending limit :"))
print("Fibonacci series upto", end_limit)
fn_fib(end_limit)
def fn_fib(el):
n1 = -1
n2 = 1
while(True):
fib = n1 + n2
if(fib > el):
return
print(fib, end = " ")
n1, n2 = n2, fib
# Main Program
end_limit = int(input("Enter ending limit :"))
print("Fibonacci series upto", end_limit)
fn_fib(end_limit)
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu