How to swap two numbers without using a temporary variable ? | Java Program to swap two numbers without using temporary variable ; Code to swap ' x ' and ' y ' x now becomes 50 ; y becomes 10 ; x becomes 5
import java . io . * ; class GFG { public static void main ( String [ ] args ) { int x = 10 ; int y = 5 ; x = x * y ; y = x / y ; x = x / y ; System . out . println ( " After ▁ swaping : " + " ▁ x ▁ = ▁ " + x + " , ▁ y ▁ = ▁ " + y ) ; } }