Wap to take a number from user and to swap them without using third variable
#include<iostream.h>
enter a,b 17
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"enter a,b";
cin>>a>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<"a="<<a<<endl;
cout<<"b="<<b;
getch();
}
***************
OUTPUT:
15
a=15
b=17
***************
No comments:
Post a Comment