Tuesday, 14 February 2017

swap two number without using third variable in Dev c++

Tags

// program to swap two number without using third variable.

#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"\n enter a:-";
cin>>a;
cout<<"\n enter b:-";
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\n after swapping: a:-"<<a<<"\n b"<<b;
return 0;

}