C++ Program to Swap Two Numbers Without Using Third(Temporary) Variable
In this program we will swap two numbers without using a third variable.
//C++ Program to swap two numbers without using third(temporary) variable
using namespace std;
int a, b;
cout<<"Enter first number: ";
cout<<"Enter second number: ";
a = a + b;
b = a - b;
a = a - b;
cout<<"Swapping of the numbers are= "<<a<<" and "<<b;
Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more.
Sign Up for our weekly newsletter to get update about new content.