Sum of all even fibonacci numbers below 4000000 c++
Answers
Answered by
1
Answer:
#include<iostream>
#include<cstdlib>
using namespace std;
int main() {
int a=1,b=1,c,sum=0;
while(c<4000000)
{
c=a+b;
if((c%2)==0)
sum+=c;
a=b;
b=c;
}
cout<<sum;
return 0;
}
HOPE YOU LIKE IT..
THEN PLEASE MAKE ME BRAINLIST OR FOLLOW ME..
Explanation:
Similar questions