- 1
I am a beginner in Python. I want to code a program which outputs all the Fabonacci numbers within 100.
For example: 0 1 1 2 3 5 8 13 21 34 ... I tried this piece of code: num1 = 0 num2 =1 num3 = num2 + num1 while num3 <= 100: print(num3) num2 = num3 num1 = num2
2 ответов
+ 1
Correct code,
num1 = 0
num2 =1
num3 = num2 + num1
while num3 <= 100:
print(num3)
num1,num2=num2,num3
num3=num2+num1
+ 1
Thank u both of u.. I'll try these and then let u know if it worked...