challenges/e2/e2.cs

15 lines
288 B
C#

using System;
public class E2 {
public static void Main() {
int sum, last, current, tmp;
last = 0;
sum = 0;
for (current = 1; current < 4000000; tmp = current, current += last, last = tmp) {
if (current % 2 == 0)
sum += current;
}
System.Console.WriteLine(sum);
}
}