GkSeries.com

Q.

Which is the correct sequence statements that swaps values of two statements?

[A] a=a+b; a=a-b; b=a-b;
[B] a=a+b, b=a-b; a=a-b;
[C] a=a-b; a=a+b; b=b-a;
[D] None of these
Answer & Explanation
Option: [B]

Let us test this with an example:

Let, a=20 and b=40. After swapping them a=40 and b=20

a=a+b; a=20+40=60;

b=a-b; 60-40=20;

a=a-b; 60-20=40;

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Please share this page

Click Here to Read more questions

Teacher Eligibility Test