one-file-projects/euler2.c

16 lines
328 B
C
Raw Normal View History

2015-11-13 02:42:54 +01:00
#include <stdio.h>
int main( int argc, char *argv[] ) {
int fib_even=2,fib_prev=1,fib_tmp;
int sum=0;
while(fib_even < 4e6) {
sum += fib_even;
fib_tmp = fib_prev + fib_even;
fib_prev = fib_even + fib_tmp;
fib_even = fib_prev + fib_tmp;
}
printf("%d\n",sum);
return 0;
}