The general method is to establish an assertion between each statement and test, then show that the assertion holds by induction on the number of steps taken by the program. In the case of a single loop program, as in this example, the key assertion is the loop invariant which is the assertion just before the loop test. To prove partial correctness for this kind of program, we must establish that the loop invariant is (a) true the first time we reach the point of the invariant, and (b) if it is true at some arbitrary time, then it is true the next time, if there is a next time. To establish (a), we build from the input assertion and the initialization of the program. Finally, we must use the loop invariant, in combination with the loop exit condition (the negation of the test), to show that the output assertion follows.