Swap the values of two variables in c++


Image result for c++


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int x,y;
cout<<"enter the value of x \n";
cin>>x;
cout<<"enter the value of y \n";
cin>>y;
cout<<"before swaping the value of "<<x<<"\n"<<y<<endl;
x=x+y;
y=x-y;
x=x-y;
cout<<"after swaping the value of "<<x<<"\n"<<y<<endl;
return 0;

}