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 : shohan4556@gmail.com | |
//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); | |
} |