#include "stdafx.h" #include <iostream> using namespace std; int main() { unsigned long Sum = 0; unsigned long InitialNum = 0; unsigned long SecNum = 1; unsigned long Temp =1; bool Continue = true; while (Continue) { cout << endl << InitialNum; if (InitialNum % 2 == 0) { cout << "even"; Sum += InitialNum; if (InitialNum >= 4000000) Continue = false; } cout << endl << SecNum; if (SecNum % 2 == 0){ cout << "even"; Sum += SecNum; if (SecNum >= 4000000) Continue = false; } cout << endl << Temp; if (Temp % 2 == 0){ cout << "even"; Sum += Temp; if (Temp >= 4000000) Continue = false; } InitialNum = (SecNum + Temp); SecNum = (InitialNum + Temp); Temp = (InitialNum + SecNum); } //end of while cout << "\nThe sum of all the even numbers is >>>> " << Sum; char f; cin >> f; return 0; }

Thanks in advance guys and gals!