The loop invariant
1 2 3 4 5
Consider the above fragment of code, with \(n\), \(p\) and \(i\) as integer variables. What is the loop invariant of the code?
Definition: A loop invariant is a condition that is necessarily true immediately before and immediately after each iteration of a loop