C++ Program to swap values of two variable without using third.

C++ Program to swap values of two variable without using third.



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Enter first number: ";
cin>>a;
cout<<"Enter second number: ";
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"The first number is: "<<a<<endl;
cout<<"The second number is: "<<b;
getch();
}


Learn More :