challenges/e2/e2.m

13 lines
279 B
Mathematica
Raw Normal View History

2011-04-01 23:37:14 +00:00
#include <objc/Object.h>
2011-04-03 06:53:00 +00:00
int main(int argc, char ** argv) {
int i, last, current, sum, tmp;
sum = 0;
last = 0;
for(current = 1; current < 4000000; tmp = current, current = last + current, last = tmp) {
if ( current % 2 == 0)
sum += current;
}
printf("%d\n", sum);
}