Name (print) ___________________________________ Lab Section you attend______________
// return the product of a and b, which must be supplied as positive integers.
public static int mpy(int a, int b) {
int ans = 0,
i = b;
while (i != 0) {
i = i - 1;
ans = ans + a;
}
return ans;
}
Develop and use a loop invariant to prove that the method computes the appropriate product. You may interact only with the professor on this problem (by IM or in person). You must be able to explain your proof in person during Lab or Studio session to the professor.