Skip to content

Instantly share code, notes, and snippets.

@anuradhawick
Created November 13, 2014 11:04
Show Gist options
  • Save anuradhawick/cba0a1f642105b5207c4 to your computer and use it in GitHub Desktop.
Save anuradhawick/cba0a1f642105b5207c4 to your computer and use it in GitHub Desktop.
Euler 2
#include <stdio.h>
void main(){
int a=1,b=1,c=2,i,sum=0;
for(i=0;i<50000;i++){
c=a+b;
a=b;
b=c;
if(c>4000000){
break;
}
if(c%2==0){
sum += c;
}
}
printf("%d ",sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment