employer cover photo
employer logo
employer logo

Tata Consultancy Services

Part of Tata Group

Engaged Employer

Tata Consultancy Services Interview Question

how to swap 2 numbers without using third variable in c programming?

Interview Answer

Anonymous

Nov 26, 2015

I knew the solution to this question. So it was easy for me to answer this. The logic is to take sum of the numbers and store it in one of the two variables. then the logic goes like below... a=a+b; b=a-b; a=a-b; check this by simple example....it works...