1.

write a program in Java to interchange the value of two variable without using the third variable and using only a single operator​

Answer»

tion:import java.util.Scanner;public class Interchage{Scanner sc= NEW Scanner (System. in);public static void main[ STRING args]{INT a,b;System. out.println ("Enter TWO numbers ");a= sc.nextInt();b=sc.nextInt();System. out.println ("number before swapping "+a+b);a=a+b;b=a-b;a=a-b;System. out.println ("number after SWAP");} }



Discussion

No Comment Found