Fibonacci Series with while loop in Python

Fibonacci Series with while loop in Python 👍

 n=int(input("Enter Value of n :"))

a=0
b=1
c=a+b
print(a)
print(b)
while c<=n:
print(c)
a=b
b=c
c=a+b


Output :

Enter Value of n :4 0 1 1 2 3

0 comments:

Post a Comment

gurnoorsingh5974@gmail.com

Count Upper Case and Lower Case Word in a string (Python)

  Count Upper Case and Lower Case Word in a string     (Python) def string_test(s):     d={"UPPER_CASE":0, "LOWER_CASE":...