what is the use of control variable in a loop?
Answers
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.
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
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
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.