Created
October 31, 2014 01:55
-
-
Save shohan4556/d834c8311ef659630bad to your computer and use it in GitHub Desktop.
pe02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------*/ | |
// 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