What are the values of the variables a and b after the Processing program below has been executed?

----------------------------------------------------------------------------------------------------------------------------
int a, b, temp;
a = 5;
b = 10;
temp = a;
a = b;
b = temp;
println (a,b);
----------------------------------------------------------------------------------------------------------------------------

A. a = 10 and b = 5

B. a = 10 and b = 10

C. a = 5 and b = 5

D. a = 5 and b = 10

Answer :

MrRoyal

The values of variables a and b after the processing program has been executed are (A) a = 10 and b = 5

By analyzing the program, we understand that:

The program swaps the values of variables a and b using a temp variable

On lines 2 and 3, the values of variables a and b are 5 and 10, respectively.

When these values are swapped on line 3 through line 5, the new values of variables a and b become 10 and 5, respectively.

Hence, the values of variables a and b after the processing program has been executed are (A) a = 10 and b = 5

Read more about similar programs at:

https://brainly.com/question/16397886

Other Questions