(Solved):Determine the output of the following code segment. You must trace the code to show how you reached the answer. int x = 2, y = 3; x = x + y; y = x – y; x = x – y; printf(“x is %dn”, x); printf(“y… View Answer…

 

Question

Determine the output of the following code segment. You must trace the code to show how you reached the answer.

int x = 2, y = 3;

x = x + y;

y = x – y;

x = x – y;

printf(“x is %dn”, x);

printf(“y is %dn”, y);

 

EXPERT ANSWER

The output of the program is as follows:

x is 3
y is 2
                                                                                                                                               
                                                                                                                                               
...Program finished with exit code 0
Press ENTER to exit

Scroll to top