Ask Question
30 May, 03:30

considering that two variables counters and accumulators are important in loop design. What would be their purpose?

+3
Answers (1)
  1. 30 May, 06:22
    0
    Counters are used to run the loop.

    Accumulators are used to calculate and store the result.

    Explanation:

    In loops variables counters and accumulators are very important. The counter variable is used to increase the loop or move to the next iteration.

    The accumulator variable is used to calculate and store the result of an operation in the loop.

    For example:-

    int i=0;

    int sum=0;

    while (i<7)

    {

    sum=sum+i;

    i++;

    }

    In this while loop the counter variable is i and the accumulator variable is sum. Without the counter variable is not increased the loop will keep looping over the same value of i that is 0.

    In the loop the accumulator variable sum is used to calculate the sum of integers form i=0 to 6.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “considering that two variables counters and accumulators are important in loop design. What would be their purpose? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers