Possible Duplicate:
C++ Programming help
its not working properly it needs to display the sum of the even integers betweena nd including two numbers enter by the users!
what am i misssing its driving me crazy
int main(){
// declare variables
int num1 = 0;
int num2 = 0;
int sum= 0;
cout << "Enter the First Number:" << endl;
cin >> num1;
cout << "Enter the Second Number:" << endl;
cin >> num2;
int num1 = num1 % 2 == 0 ? num1 : num1+1; int num2 = num2 % 2 == 0 ? num2 : num2-1; for (int i = num1; i <= num2; i += 2) sum += i;
return 0;
} // end of main function