✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Given the following code to compute "n to the power of x"
static int fastPower(int n, int x){
int a= x; int b= 1; int i= n;
while(i>0) {
if (i%2==0){
a= a*a;
i= i/2;
}
else {
b= a*b;
i= i-1;
}
}
return b;
}
Which of the following logical statements is a valid and useful invariant for proving this code does actually compute n to the power of x?