Sunday, 27 November 2011

C++ Program For Swap Two Valuse With Out Third Variable


#include<iostream.h>
#include<conio.h>
void main()
 {
  
   int a,b,c;
   cout<<"Enter 1st value";
   cin>>a;
   cout<<"Enter 2nd value";
   cin>>b;
   a=a+b;
   b=a-b;
   a=a-b;
   cout<<"New value of a="<<a<<endl;
   cout<<"New value of b="<<b;
   getch();
 }

No comments:

Post a Comment