✍️ Get Writing Help
WhatsApp

Recursive function

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 < test(8,=”” 2)=””>< endl;=””>

b. cout < test(5,=”” 16)=””>< endl;=””>

c. cout < test(-25,=”” 2)=””>< endl;=””>

d. cout < test(8,=”” -6)=””>< endl;=””>

e. cout < test(-20,=”” -36)=””><>

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)

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102