Consider the following method to compute the greatest common
denominator of two numbers.
Say we call sqrt(32). Show how the values of x and d change as the computer continues through the method.public static int sqrt(int n) { int x = 0; int d = n; while(d > 0) { if((x + d) * (x + d) <= n) x += d; d /= 2; } return x; }
x d
x 0 4 5 d 32 16 8 4 2 1 0