#include<iostream>
using namespace std;
void swap1(int &a,int &b) //commonly used
{
int temp;
temp=a;
a=b;
b=temp;
}
void swap2(int &a,int &b) //doesnt involve the use of a temporary variable
{
a=a+b;
b=a-b;
a=a-b;
}
int main()
{
int a,b;
cout<<"enter two numbers :";
cin>>a>>b;
swap1(a,b);
cout<<a<<" "<<b;
swap2(a,b);
cout<<a<<" "<<b;
system("pause");
return 0;
}