For input a = 8&b=9.
function (input a, input b)
If (a < b)
return function (b, a)
elseif (b !=)
return (a + function (a, b - 1))
else
return @
Answers
Answered by
0
Answer:
72
Explanation:
we are just adding 9-8 times. like 9+9+9+9+9+9+9+9+function (9,0).
Answered by
0
Answer:
The output is 72.
Explanation:
This is a recursion function.
- As a < b, so function (b, a) will run. Now, the input is a = 9 & b = 8.
- Here, a > b and b!=0, so [a + function (a, b - 1)] will run. Then the input becomes a = 9 & b = 7.
- Again a > b, so step 2 is repeated till b = 0.
- Now, the value of a is added to the output of the function.
- So, the final output is 72.
Using a tree diagram also we can get the output of the recursion function.
To know more about recursion, click on the link below:
https://brainly.in/question/25178065
To know more about tree diagrams, click on the link below:
https://brainly.in/question/30002328
#SPJ3
Similar questions