challenges/e2/e2.m

13 lines
279 B
Objective-C

#include <objc/Object.h>
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);
}