Program for swapping (without using third variable)






#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"ENTER VALUE FOR a=";
cin>>a;
cout<<"ENTER VALUE FOR b=";
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"-----------AFTER THE SWAPPING-----------\n a="<<a<<" b="<<b;
getch();

}

No comments:

Post a Comment

We are here to listen you, Comment your valueable opinion...!!!