swap two numbers without taking third variable in cpp
Answers
Answered by
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
English,
3 hours ago
English,
3 hours ago
Math,
3 hours ago
Computer Science,
6 hours ago
India Languages,
8 months ago
English,
8 months ago