Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created October 31, 2014 01:55
Show Gist options
  • Save shohan4556/d834c8311ef659630bad to your computer and use it in GitHub Desktop.
Save shohan4556/d834c8311ef659630bad to your computer and use it in GitHub Desktop.
pe02
/*------------------------------------------------*/
// problem source: projecteuler.net
// Problem No: 02
//Problem Name : Even Fibonacci numbers
//Author : Shohanur Rahaman
//University : City University
//E-mail : [email protected]
//N.B: While Submit the code erase all the coments above
/*-----------------------------------------------*/
#include<stdio.h>
int main()
{
int long long display,sum=0;
int i,t1=0,t2=1;
display=0;
while(display<4000000){
// printf(" %lld\n ",display);
display=t1+t2;
t1=t2;
t2=display;
if(display%2==0)
sum=sum+display;
}
printf("The sum of all even value : %lld \n ",sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment