Write a program to swap two numbers without using third variable

Write a program to swap two numbers without using third variable.

hello @pushaansharma

u can do it like this->
read a and b

  1. a=a+b;//a=30 (10+20)
  2. b=a-b;//b=10 (30-20)
  3. a=a-b;//a=20 (30-10)
    a and b are swapped now

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.