Mindsprint interview question

swap two number without using new variable

Interview Answer

Anonymous

16 Oct 2024

int a = 5; int b = 10; // Swapping process a = a + b; b = a - b; a = a - b; System.out.println("a = " + a + ", b = " + b);