August 2, 2016

SWAPPING

C++ PROGRAM FOR SWAPPING

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x,y,z;
cout<<"x:\t";
cin>>x;
cout<<"\ny:\t";
cin>>y;
z=x-y;
cout<<"\nz:\t"<<z;
x=x-z;
cout<<"\nAfter swaping x=\t"<<x;
y=y+z;
cout<<"\nAfter swaping y=\t"<<y;
getch();
}

No comments:

Post a Comment

Disqus Shortname

Comments system