How to swap two numbers without using a temporary variable ? | C ++ Program to swap two numbers without using temporary variable ; Code to swap ' x ' and ' y ' x now becomes 15 ; y becomes 10 ; x becomes 5
#include <bits/stdc++.h> NEW_LINE using namespace std ; int main ( ) { int x = 10 , y = 5 ; x = x * y ; y = x / y ; x = x / y ; cout << " After ▁ Swapping : ▁ x ▁ = " << x << " , ▁ y = " << y ; }