Question: / / Program Count prompts for, reads, echo prints, and sums a / / fixed number of integer values. The sum is printed. #include using

// Program Count prompts for, reads, echo prints, and sums a
// fixed number of integer values. The sum is printed.
#include
using namespace std;
const int LIMIT =10;
int main ()
{
int counter; // Loop-control variable
int sum; // Summing variable
int dataValue; // Input value
counter =1;
sum =0;
// Input and sum integer data values.
while (counter <= LIMIT)
{
cout << "Enter an integer value. Press return." << endl;
cin >> dataValue;
sum = sum + dataValue;
counter++;
}
cout << "Sum is "<< sum << endl;
return 0;
}
Exercise 1.
Just by reading the program count without running it, show the results that will be printed, if the
following data values are entered as prompted?
8-53-20917310
Exercise 2.
Change program Count so that the number of values to be read (LIMIT) is read from
the keyboard rather than being set as a named constant. (Dont forget to prompt for LIMIT.) Run your
program using a value of your choice for LIMIT and entering the integer data values accordingly. Show
your results in the report.
Exercise 3.
Use the program shell below to implement a program called SumDigits. When completed, program
SumDigits prompts for and reads a one-digit number, then adds the numbers from zero to the number,
inclusive, and prints the sum

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!