summaryrefslogtreecommitdiff
path: root/002.c
diff options
context:
space:
mode:
Diffstat (limited to '002.c')
-rw-r--r--002.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/002.c b/002.c
new file mode 100644
index 0000000..7a16a80
--- /dev/null
+++ b/002.c
@@ -0,0 +1,20 @@
+int main()
+{
+ int previous = 1, next = 2;
+ int sum = 0, tmp = 0;
+
+ while(next <= 4000000)
+ {
+ if(!(next & 1))
+ sum += next;
+
+ tmp = next;
+ next += previous;
+ previous = tmp;
+ }
+
+ printf("%ld\n", sum);
+
+ return 0;
+}
+