Which type of variable is total and what is it used for?
void countUp()
{
int total = 0;
for (int i = 0; i < 100; i++)
{
std::cout << i<< std::endl;
total = total + i;
}
A. An accumulator variable. It is used to store the sum of all i values |
B. A counter variable. It is used to determine the number of times the loop will repeat. |