28.4k views
3 votes
Counter-controlled iteration requires _________. a. A control variable and initial value. b. A control variable increment (or decrement) c. A condition that tests for the final value of the control variable d. All of the above

User Nebiros
by
5.9k points

1 Answer

7 votes

Answer:

Counter-controlled iteration requires all of the above

Explanation:

Counter-controlled iteration, also known as definite iteration which means that the number of iterations is known before we start the execution of the body of the loop.

A counter controlled iteration must have an initial value (also known as a start value), a test condition for the iteration to be valid and a control variable which could either be increment of decrement.

Taking the following code segment written in C++ programming language;

for(int I = 0; I<= 10; I++)

{

// Some codes here

}

The above is a definite or counter controlled iteration..

The initial value is 0

It is to be incremented by 1

The test condition is I<=10.

All which my must be satisfied.

User Nelshh
by
6.4k points