The following recursive function

Consider the following function:

int recEx13(int x)

    if (x <=>

        return 0;

    else if (x == 1)

        return 2;

    else

        return (recEx13(x – 1) + recEx13(x – 2)

                  + recEx13(x – 3));

 

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

a. cout < recex13(-2)=””>< endl;=””>

b. cout < recex13(3)=””>< endl;=””>

c. cout < recex13(4)=””>< endl;=””>

d. cout < recex13(9)=””><>

Consider the following recursive function:

 void recFun(int x, int y)

    if (x > 0 && y > 0)

   

        if (x >= y && y != 0)

       

            cout < x=”” %=”” y=””>< “=””>

            recFun(x – y, y);

       

        else if (y > x && x != 0)

       

            cout < y=”” %=”” x=””>< “=””>

            recFun(y – x, x);

       

   

    Else

         cout < x=”” +=”” y=””><>

 

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

a. recFun(180, 38);

b. recFun(75, 26);

c. recFun(13, 86);

d. recFun(56, 148);

WhatsApp
Hello! Need help with your assignments?

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

🛡️ Worried About Plagiarism? Run a Free Turnitin Check Today!
Get peace of mind with a 100% AI-Free Report and expert editing assistance.

X