Skip to content
Snippets Groups Projects
Commit d5fd4ac8 authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

Implementation of WHILE program for fibonacci

parent 6d61161b
No related branches found
No related tags found
No related merge requests found
fib.py 0 → 100644
def fib(x):
result = 0
result_before = 0
while not x == 0:
x -= 1
if result == 0:
result = 1
else:
tmp = result + result_before
result_before = result
result = tmp
return result
for i in range(10):
print(fib(i))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment