To swap two numbers without using third variable

To swap two numbers without using third variable in C++
Program:-
#include<iostream.h>
#include<conio.h>
int main()
{   int a,b;
a=10;
b=20;
cout<<"\nA  =  "<<a;
cout<<"\nB  =  "<<b;
        a=a+b;
        b=a-b;
a=a-b;
cout<<"\nswaping  without using third variable ";
cout<<"\nA  =  "<<a;
cout<<"\nB  =  "<<b;
getch();
return 0;
}

Output:-

Comments