Sunday, March 7, 2010

C++ PROGRAM TO INTERCHANGE TWO VALUES WITHOUT USING THE THIRD VARIABLE..

void main(){
 int x,y;
 clrscr();
 cout<<"ENTER THE VALUES OF X AND Y :";
 cin>>x>>y;
 cout<<"BEFORE CHANGING";
 cout<<"\n X = "<<<"\n Y = "<<
 cout<<"AFTER CHANGING";
 x=x+y;
 y=x-y;
 x=x-y;
 cout<<"\n X = "<<<"\n Y = "<<
 getch();
}

No comments:

Post a Comment