PROGRAM TO SWAP TWO NUMBERS USING C++
/*PROGRAM TO SWAP TWO NUMBERS*/
#include<iostream.h>
#include<conio.h>
#include<conio.h>
#define SWAP(a,b) {int temp; temp=a; a=b; b=temp;}
void main()
{
clrscr();
intx,y;
cout<<“Enter two numbers:”;
cin>>x>>y;
{
clrscr();
intx,y;
cout<<“Enter two numbers:”;
cin>>x>>y;
cout<<“x=”<<x<<” y=”<<y;
SWAP(x,y);
cout<<“nx=”<<x<<” y=”<<y;
getch();
}
SWAP(x,y);
cout<<“nx=”<<x<<” y=”<<y;
getch();
}
Output :-
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment