how to print fibonacci series using while loop in python?
Answers
Answered by
3
Answer:
Python Fibonacci Series program Using While Loop
While (0 < 4) is TRUE. So, Fibonacci Series program starts executing statements inside the while loop.
Within the while loop, we have If statement and the condition if (0 <= 1) is TRUE. So, Next = 0 and compiler exit from if statement block.
Print statement print(Next) print the value 0.
Lastly, i incremented to 1.
Answered by
1
Answer:
here is your answer
level = int(input("enter the level upto which you want to print the fibonacci series: "))
a = 0
b = 1
print(a)
print(b)
count = 0
sum = 0
while count != level:
sum = a+b
print(sum)
a = b
b = sum
count = count + 1
Similar questions
Social Sciences,
1 month ago
Math,
2 months ago
English,
2 months ago
Science,
10 months ago
Science,
10 months ago