Consider the following recursive function fun(x, y). What is the value of fun(4, 3)
int fun(int x, int y) {
if (x == 0)
return y;
return fun(x - 1, x + y);
}
int fun(int x, int y)
{
if (x == 0)
return y;
return fun(x - 1, x + y);
}
int fun(int x, int y) {
if (x == 0)
return y;
return fun(x - 1, x + y);
}
def fun(x, y):
if x == 0:
return y
return fun(x - 1, x + y)
function fun(x, y) {
if (x === 0)
return y;
return fun(x - 1, x + y);
}
13
12
9
10
This question is part of this quiz :
Top MCQs on Recursion Algorithm with Answers