Skip to content

Instantly share code, notes, and snippets.

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