// Simple running total example. // Total all the integers between a lower and an upper bound. #include using namespace std; int main() { const int LOWER_BOUND = 0; const int UPPER_BOUND = 10; int num = LOWER_BOUND; // counter int sum = 0; // accumulator while (num <= UPPER_BOUND) { sum += num; // add the new value to the accumulator num++; } cout << "The sum of integers from " << LOWER_BOUND << " to " << UPPER_BOUND << " is " << sum << endl; return 0; }