CBSE Class 11 Computer Science Question 34 of 80

Conditional and Looping Constructs — Question 4

Back to all questions
4
Question

Question 4

What is the significance of updating loop control variable in while statements?

Answer

Updating the loop control variable in while statements is essential to prevent infinite loops. If the loop control variable is not updated within the loop body, the condition may always evaluate to true, causing the loop to run indefinitely.