English

Does testing the loop condition affect the loop invariant? Why?

Advertisements

Question

Does testing the loop condition affect the loop invariant? Why?

Short/Brief Note
Advertisements

Solution

No, the loop condition does not affect the loop invariant. Because the loop invariant is true at four points.

  1. At the start of the loop.
  2. At the start of each iteration.
  3. At the end of each iteration.
  4. At the end of the loop.
shaalaa.com
Loop Invariant
  Is there an error in this question or solution?
Chapter 8: Iteration and recursion - Evaluation - Section - B [Page 113]
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×