Computer Science, asked by babitamadhesiya38, 4 months ago

what is the use of control variable in a loop?​

Answers

Answered by Hαrsh
12

 {\huge {\underline {\mathcal {❥} \red {A} \blue {n} \green {s} \orange {w} \pink {e} \purple {r}}}}

Explanation:

A common use of loops is the one in which the loop makes use of a variable (called control variable) that at each iteration is changed by a constant value, and whose value determines the end of the loop. Example: Print the squares of the integers between 1 and 10.

Answered by Anonymous
5

Answer:

The variable count is initialized, tested, and changed as the loop executes. It is an ordinary int variable, but it is used in a special role. The role is that of a loop control variable. Not all loops have loop control variables, however.

The type of loop we have been looking at is a counting loop, since it counts upwards using the loop control variable as a counter. You can make counting loops with statements other than the while statement, and not all while loops are counting loops.

hope this helps you

Answered by Anonymous
6

Answer:

The variable count is initialized, tested, and changed as the loop executes. It is an ordinary int variable, but it is used in a special role. The role is that of a loop control variable. Not all loops have loop control variables, however.

The type of loop we have been looking at is a counting loop, since it counts upwards using the loop control variable as a counter. You can make counting loops with statements other than the while statement, and not all while loops are counting loops.

hope this helps you

Answered by Anonymous
6

Answer:

The variable count is initialized, tested, and changed as the loop executes. It is an ordinary int variable, but it is used in a special role. The role is that of a loop control variable. Not all loops have loop control variables, however.

The type of loop we have been looking at is a counting loop, since it counts upwards using the loop control variable as a counter. You can make counting loops with statements other than the while statement, and not all while loops are counting loops.

hope this helps you

Similar questions