diff --git a/Solutions/Even Fibonacci numbers.cpp b/Solutions/Even Fibonacci numbers.cpp new file mode 100644 index 0000000..7177579 --- /dev/null +++ b/Solutions/Even Fibonacci numbers.cpp @@ -0,0 +1,29 @@ +#include +#include +using namespace std; + +int main(){ + vectorhave; + unsigned int n,f0=0,f1=1,temp=f1,sum=0,k=0; + cin >> n; + while(f1 < n){ + temp = f0 + f1; + if(temp < n && temp < 40000000){ + cout << temp << " "; + if(temp % 2 == 0){ + have.push_back(temp); + sum += temp; + k++; + } + } + f0 = f1; + f1 = temp; + } + cout << endl; + cout << "We Have {"; + for(int i=0;i