#include <iostream>
using namespace std;
int main()
{
int sum = 0; // Declare an int variable sum to accumulate the numbers
int lowerbound; // Set the initial sum to 0
int upperbound; // Sum from 1 to this upperbound
// Prompt user for an upperbound
cout << "Enter a integer: ";
cin >> upperbound;
cout << "Enter another integer: ";
cin >> lowerbound;
while (lowerbound <= 100 && upperbound <= 100)
{
sum = sum + upperbound++ + lowerbound++;
}
// Print the result
cout << "The total of the numbers " << upperbound << " and " << lowerbound << " is " << sum << endl;
}
garber -3 Newbie Poster
daviddoria 334 Posting Virtuoso Featured Poster
garber -3 Newbie Poster
TheSassyDragon 0 Newbie Poster
daviddoria 334 Posting Virtuoso Featured Poster
garber -3 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
TheSassyDragon 0 Newbie Poster
garber -3 Newbie Poster
Caligulaminus 35 Junior Poster
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
Despairy 0 Light Poster
garber -3 Newbie Poster
daviddoria commented: Still not listening to the suggestions! Give it another try and we can try to guide you. This problem is so short that we can't really help anymore without flat out writing it for you. -3
Blackiey 0 Junior Poster in Training
daviddoria 334 Posting Virtuoso Featured Poster
mir wasif 0 Newbie Poster
daviddoria 334 Posting Virtuoso Featured Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
mir wasif 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.