How to swap value without using Temporary Variable ?

 Posted by Ajay.Kalol on 5/8/2012 | Category: Others Interview questions | Views: 1943 | Points: 40
Answer:

X = 10 Y = 2

X = X + Y; (10 + 2 = 12)
Y = X - Y; (12 - 2 = 10)
X = X - Y; (12 - 10 = 2 )

After this X = 2 AND Y = 10


Asked In: My Interviews | Alert Moderator 

Comments or Responses

Login to post response