Khan.randRange(1, 10) Khan.randRange(1, 10) rectFIBallk.checkAnswer(k, n)

Consider the following function:

public int f(int k , int n) {
  if (n == k)
    return k;
  else if(n > k)
    return f(k, n - k);
  else
    return f(k - n, n);
}

What value is returned by the call f(k,n)?
(Either write a number, or write "infinite recursion".)

ANS

If n is greater than k then the first recursive call will execute. Otherwise, the second one will excuse.

In either cases, n or k is decremented until they are equal.

So this computes the greatest common divisor of k and n.