Skip to content

Instantly share code, notes, and snippets.

@cuihaoleo
Last active August 29, 2015 14:06
Show Gist options
  • Save cuihaoleo/c40d1762f4fd2c9ce7f8 to your computer and use it in GitHub Desktop.
Save cuihaoleo/c40d1762f4fd2c9ce7f8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main ()
{
int a = 0, b = 1, c = 1, sum = 0;
while (c < 4000000)
{
if (c % 2 == 0)
sum += c;
c = a + b;
a = b;
b = c;
}
printf("%d\n", sum);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment