Question: In the following program segment, which variable is the counter and which is the accumulator? int x = 0 , y = 0 , z

In the following program segment, which variable is the counter and which is the accumulator?
int x =0, y =0, z=0;
cout<<How many numbers do you wish to enter?
;
cin >>x;
while (z++< x)
{
int a;
cout<<Enter a number:
;
cin>>a;
y +=a;
}
cout<<The sum of those number is << y << endl;
Group of answer choices
y is the counter and x is the accumulator
y is the counter and z is the accumulator
y is the counter and a is the accumulator
z is the counter and a is the accumulator
z is the counter and y is the accumulator
z is the counter and x is the accumulator

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 Programming Questions!