Consider the following recursive function: int test(int x, int y) { if (abs(x - y) return x + y; else if (x > y) return test(x - 1, y + 1); else if (y > x) return test(x + 1, y - 1); } What...


Consider the following recursive function:


int test(int x, int y)



{



if (abs(x - y)



return x + y;


else if (x > y)



return test(x - 1, y + 1);



else if (y > x)



return test(x + 1, y - 1);



}



What is the output of the following statements? (4, 6)


a. cout <><>


b. cout <><>


c. cout <><>


d. cout <><>


e. cout <>


Write a recursive algorithm to multiply two positive integers m and n using repeated addition. Specify the base case and the recursive case. (2, 3, 4, 6)





May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here