//contAndBreak.cpp //continue vs. break //for loops, ++, +=, % #include using namespace std; int main() { //add the first 7 numbers int value=0; for (int i=1; i<=7;i++) value+=i; cout <<" 1+...+7 =" << value; //enter 10 numbers and sum the even ones int count,term,sum=0; cout << "Enter 10 numbers.\n"; for (count=1;count<=10;count++) { cin >> term; if (term%2 != 0) continue; sum = sum + term; } cout << "The sum of the evens is " << sum << endl; //enter 10 number and sum them. //Quit as soon as an odd is entered. cout << "Enter 10 numbers.\n"; sum=0; //some compilers would complain if you wrote //for (i=1;i<=10;i++) //others would complain if you wrote //for (int i; i<=10; i++) for (count=1; count<=10; count++) { cin >> term; if (term%2 != 0) break; sum = sum + term; } cout << "The sum up to the first odd is " << sum << endl; return 0; }