LATEST PROGRAMS
CPP
Write a Program in C++ to swap two numbers without using third variable.
#include<iostream.h>
using namespace std;
int main()
{
int a, b;
cout<<"Enter the two numbers :\n";
cin>>a>>b;
cout<<"Before swapping a = "<<a<<" b = "<<b;
a=a^b;
b=a^b;
a=a^b;
cout<<"\n After swapping a = "<<a<<" b = "<<b;
return 0;
}