Ask Question
26 November, 03:10

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

+1
Answers (1)
  1. 26 November, 06:43
    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?
Find an answer to your question ✅ “considering that two variables counters and accumulators are important in loop design. What would be their purpose? ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers