PROGRAM ON SWAPPING WITHOUT THIRD VARIABLE
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
cout<<"Enter the two no.:";
cin>>a>>b;
b=a+b;
a=b-a;
b=b-a;
cout<<"Values after swapping is:"<<a<<" "<<b;
getch();
}
#include<conio.h>
void main()
{
int a,b;
clrscr();
cout<<"Enter the two no.:";
cin>>a>>b;
b=a+b;
a=b-a;
b=b-a;
cout<<"Values after swapping is:"<<a<<" "<<b;
getch();
}
Comments
Post a Comment