prog2.c
360 Bytes
#include "stdio.h"
#define STEP 4000000
main () {
long int sum;
int one, two, three;
one=1;
two=2;
three = 0;
sum = 0;
while (two <= STEP){
three = one + two;
// printf ("%i,", three);
if ( (two % 2 ) == 0)
sum += two;
// printf ("sum is now: %lu\n", sum);
one = two;
two = three;
}
printf ("Sum = %lu\n", sum);
return 0;
}