using System; using System.Collections.Generic; using System.Text; namespace Euler2 { //Find the sum of all the even-valued terms in the Fibonacci sequence //which do not exceed four million. class Program { static void Main(string[] args) { long sum = 2; long i = 1; long j = 2; while(j < 4000000) { long buff = j; j += i; i = buff; if (j % 2 == 0) sum += j; } Console.WriteLine("sum of all the even-valued terms in the fibo sequence which do not exceed four million: " + sum); } } }