Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Question

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;

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Random GK Questions

Assam Direct Recruitment Test Series

Computer Science Topics