Thursday 21 February 2013

Swapping without third variable

| |


#include<iostream>
using namespace std;
int main()
{
int a,b;

cout<<"Enter the two numbers ";
cin>>a>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"Now a="<<a<<endl<<"Now b="<<b;
system ("pause");
return 0;
}
 

Swapping without third variable


Related Posts Plugin for WordPress, Blogger...
Powered by Blogger.