Wednesday 27 June 2012

c++ program that swap the value of two number without using other variable.


#include<iostream>
using namesapace std;
int main()
{
int a,b;
cout<<"Enter the first number A:- \n";
cin>>a;
cout<<"Enter the second  number B:- \n";
cin>>b;



a=a+b;
b=a-b;
a=a-b;
cout<<"The result is: \n";
cout<<"A: "<<a<<" , "<<"B: "<<b;

return 0;
}

No comments:

Post a Comment