swap two no without using third variable

Answer Posted / srinathsv

Suppose the 2 variables be 'a' & 'b'

Then,do the following steps

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

eg:Say a=10;b=6.The output should be a=6;b=10

a=a-b=10-6=4
b=a+b=4+6=10
a=b-a=10-4=6

Is This Answer Correct ?    35 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

create a .dll component operation and use created component in another project. required methods events and properties. connect, add,search,data report

2183


how exactly is the lngColour used?

1878


Write a script to delete all the files in a folder except one desired file.

1001