Swapping the variables
#include<iostream>
using namespace std;
int main()
{
int a,b;
cout<<"enter two numbers respectively "<<endl;
cin>>a>>b;
cout<<"\nBefore Swapping : ";
cout<<"\n"<<a<<"\t"<<b;
a=a+b;
b=a-b;
a=a-b;
cout<<"\nAfter Swapping : ";
cout<<"\n"<<a<<"\t"<<b;
cout<<"\n\n";
return 0;
}
No comments:
Post a Comment