Computer Science, asked by greeshmasri2000, 6 hours ago



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 sai385126
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 dikshaagarwal4442
0

Answer:

The output is 72.

Explanation:

This is a recursion function.

  1. As a < b, so function (b, a) will run. Now, the input is a = 9 & b = 8.
  2. Here, a > b and b!=0, so [a + function (a, b - 1)] will run. Then the input becomes a = 9 & b = 7.
  3. Again a > b, so step 2 is repeated till b = 0.
  4. Now, the value of a is added to the output of the function.
  5. 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