Swap 2 variables without using a temp variable

Answers were Sorted based on User's Feedback



Swap 2 variables without using a temp variable..

Answer / guest

a,b
a=a+b
b=a-b
a=a-b

Is This Answer Correct ?    21 Yes 0 No

Swap 2 variables without using a temp variable..

Answer / sheetal

if a=5 and b=3 are two variables, then add them i e
a=a+b; a=8
b=a-b; b=5
a=a-b; a=3

Is This Answer Correct ?    12 Yes 0 No

Swap 2 variables without using a temp variable..

Answer / mfsi_satyakamm

int x,y;
x=x+y;
y=x-y;
x=x-y;

Is This Answer Correct ?    12 Yes 1 No

Swap 2 variables without using a temp variable..

Answer / s n

try this one line swaping of two variables


a=((a+b)-(b=a));

Is This Answer Correct ?    3 Yes 5 No

Post New Answer

More Manual Testing Interview Questions

How is your project connected to the Database...tell the procedure??

2 Answers   SuperValu,


can any one explain the example of high servity and low priority, low servity and high priority, high servity and high priority, low servity and low priority

4 Answers   Intact Solutions,


can testing and development be done in same environment?

4 Answers   CTS,


what is master review and peer review

3 Answers  


What is the difference between software Product and Project

14 Answers   AppLabs,


what is the difference between Client server application and web based application

6 Answers   HCL,


How we can test the performance of an application by manual with out using any tool like loadrunner etc?

10 Answers   Kanbay,


Tell me the algo for convering number into words. Meanse if the number is 4567 then it should print Four Thousand Five Hundred Sixty Seven

0 Answers  


hi friends i have a question while the files are uploading into the web server(for storing)..... securely......... what is the meaning securely.......its regarding virus threating or user authentication.... the files are video files these are ripping and converted into .flv format pls clarify ..........thanks in advance......

0 Answers  


How to integrate Bugzilla with QTP?

0 Answers   Infosys,


Hi I want to start online training couses for testing Any body plz help me out how to start the online courses Plz post the answer here or send me a mail for kommineni.1020@gmail.com

0 Answers  


Currently iam working in a small concern as a test engineer, i have 3.6 yrs exp in manual testing, currently iam looking for other concern, but some my friends saying that testing is no longer, plz switch over to designing, but iam interested in only testing, i want to know whether the Testing has a boom or not? plz guide me

4 Answers  


Categories