English, asked by ashtureniki, 6 hours ago

swap two numbers without taking third variable in cpp

Answers

Answered by pms5e6
0

Answer:

C++ Program to swap two numbers without third variable

1. #include <iostream>

2. using namespace std;

3. int main()

4. {

5. int a=5, b=10;

6. cout<<"Before swap a= "<<a<<" b= "<<b<<endl;

7. a=a*b; //a=50 (5*10)

8. b=a/b; //b=5 (50/10)

Similar questions