techo_choco
Friday, 20 January 2012
Swapping without using 3rd(temp) variable.........
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
cout<<"ENTER TWO NUMBERS\n";
cin>>a>>b;
cout<<"a="<<a<<"\n"<<"b="<<b<<endl;
a=a+b;
b=a-b;
a=a-b;
cout<<"AFTER SWAPPING\n";
cout<<"a="<<a<<"\n"<<"b="<<b;
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment