% Project Euler Problem 2

fm2 = 1;
fm1 = 2;
f = fm1 + fm2;
the_sum = 2;
while (f <= 4e6)
    if (mod(f,2)==0)
        the_sum = the_sum + f;
    end
    fm2 = fm1;
    fm1 = f;
    f = fm1 + fm2;
end
fprintf('the sum is %d\n', the_sum)
