Question: In the following program segment, which variable is the loop control variable (also known as the counter variable) and which is the accumulator? int a,
In the following program segment, which variable is the loop control variable (also known as the counter variable) and which is the accumulator?
int a, x = 0, y = 0;
while (x < 10)
{
a = x * 2;
y += a;
x++;
}
System.out.println("The sum is " + y);
Step by Step Solution
3.43 Rating (162 Votes )
There are 3 Steps involved in it
The Python for statement iterates over the members of a sequence in order executing the block each ... View full answer
Get step-by-step solutions from verified subject matter experts
