In the following program segment, which variable is the counter and which is the accumulator?
int number, x = 0, y = 0, maxNums;
cout << "How many numbers do you wish to enter? ";
cin >> maxNums;
while (x < maxNums)
{
cout << "Enter a number: ";
cin >> number;
y += number;
x++;
}
cout << "The sum of those numbers is " << y << endl;
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.