Skip to content

Commit

Permalink
Merge pull request #208 from shiveshhhhsingh1723/main
Browse files Browse the repository at this point in the history
added Fibonacci using iteration
  • Loading branch information
Open-Source-you authored Oct 21, 2024
2 parents 3df4fb3 + d6a10e2 commit 0f395be
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fibonacci/Fibonacci using iteration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Find Fibonacci Series in Python Using While Loop
# we are taking a number from user as input

# entered value will be converted to int from string
n = int(input("Number of Fibonacci Series to be Printed: "))

# print initial 2 number to start fibonacci series
a, b = 0, 1
print(a, b, end=' ')

i = 0
while (i < n-2):
c = a + b
# add the last two numbers and print
print(c, end=' ')
a = b
b = c
i = i + 1

0 comments on commit 0f395be

Please sign in to comment.