Computer Science, asked by janvi2055, 4 months ago

WAP in Java to interchange the value of two numbers, without using the third variable​​

Answers

Answered by sayan3817
0

Explanation:

class Interchange

{

public static void main(int x, int y)

{

System.out.println("Before swapping");

System.out.println("value of x:" + x);

System.out.println("value of y:" + y);

System.out.println("After swapping");

x = x + y;

y = x - y;

x = x - y;

System.out.println( "Interchanged value of x=" +x);

System.out.println( "Interchanged value of y=" +y);

}

}

Similar questions