Advertisements
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.
- At the start of the loop.
- At the start of each iteration.
- At the end of each iteration.
- At the end of the loop.
shaalaa.com
Loop Invariant
Is there an error in this question or solution?
