Finished problem 2: sum of even fibonacci numbers

This commit is contained in:
2020-03-28 03:30:48 +01:00
parent fafebcde78
commit d6d94b3866

21
2/main.py Normal file
View File

@@ -0,0 +1,21 @@
import os
# Find the sum of all Fibonacci numbers below four million
s = 0
n = 1
m = 1
while m < 4000000:
temp = m
m = n + temp
n = temp
if m % 2 == 0:
s = s + m
print(s)