Consider the following recursive function. int function (int x, int y) { if (y…
Coal India Management Trainee CBT 2019Modified — slightly modified from the official paper; see the solution
Consider the following recursive function.
int function (int x, int y) {
if (y <= 0) return x;
return function (y, x % y);
}
The above recursive function computes ______.
- A.
GCD of x and y
- B.
yˣ
- C.
x × y
- D.
LCM of x and y
Attempted by 1236 students.
Sign up free to check your answer
Sign up freeLoading lesson…

