Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the output of the following program fragment: void find(int a, int& b, i

ID: 3532560 • Letter: W

Question

What is the output of the following program fragment:

void find(int a, int& b, int& c)
{
      int temp;

      c = a + b;

      temp = a;

      a = b;

      b = 2 * temp;

}

int main()

{

      int x, y, z;

      x = 15;

      y = 25;

      z = 30;

      find(x, y, z);

      cout << x << " " << y << " " << z << endl;

      find(y, x, z);

      cout << x << " " << y << " " << z << endl;

      find(z, y, x);

      cout << x << " " << y << " " << z << endl;

}

Explanation / Answer

new_x=y

new_y =2*x

new_z = x+y

25 30 40

30 50 55

50 60 80

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote