Monday, November 14, 2011

Swap Using Third Variable

Wap to take a number from user and to swap them using third variable



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"enter a,b";
cin>>a>>b;
c=a;
a=b;
b=c;
cout<<"a="<<a<<endl;
cout<<"b="<<b;
getch();
}


**************
OUTPUT:
enter a,b 17
15
a=15
b=17
**************

No comments:

Post a Comment