swap 2 variables without using 3 rd variable???

Answer Posted / guest

Ex:
1.
A=20,B=10
A=A-B=20-10=10
B=A+B=10+10=20
A=B-A=20-10=10

2.
A=6,B=4
A=A-B=6-4=2
B=A+B=2+4=6
A=B-A=6-2=4

The above logic works if A>B. If B>A:

B=6, A=4
B=B-A=6-4=2
A=A+B=4+2=6
B=A-B=6-2=4

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the general pattern of explanation of projects in interview, can u ans me plz.......... ex: online banking application

1595


Please Provide me the link to download Testing Category questions and answers If some body has downloaded it pleae send it to me Pavan : Email pavan_cd@yahoo.com Quetion2 : Can any body Explain me about Testing thumb rules

1717


What are tools of performance testing?

721


What will be the testcase for a uniquely generated number in the application?? i mean to say is, how will i conform the application is generating a unique value.... please do answer...

1740


What are the different ways of doing black box testing?

655






hai friends, I need clarifications for some doubts in testing terminology. 1.What is thread testing. 2.What is bucket testing and which automated tool is used to do this test. 3. ERP testin automation testing. 4.What is Data Warehousing testing? 5.What is Implementation testing? 6.What is Shake out testing? please let me have the clarifications in detail

1553


send the senario template

1498


What are the RBI rules has to follow by a bank for online precesseing. ?

1729


How to do Performance Testing manually for a Flash Application?

1858


What is bug priority?

836


write test case for gmail sign up page ?

1584


can any one send sample test cases for database testing by taking an example? also leave emailid please. thanks (very urgent)

2670


Manual and automation how do they help in bringing out quality product? Explain?

1486


Any one send me sample question for multimedia testing with microsoft access database. I am having interview next week. Please post it or send me my personal e-mail. Thank You

1587


What exactly you do as a Configuration controller?

1550