Write a program in Java to input two numbers. Display the numbers after swapping the them by using a thrid variable.
Sample Input: a= 45, b= 37 Sample output: a=37, b=45
Army ⟬⟭ plz help me with this ASAP!!
Answers
Answered by
3
Explanation:
public static void main(String args[ ]
Scanner in = new Scanner(System.in);
System.out.println("Enter two unequal numbers");
System.out.print("Enter first number: ");
int a = in.nextInt();
System.out.print("Enter second number: ");
int b = in.nextInt();
a = a + b;
b = a - b;
a = a - b;
System.out.println("a = " + a + " b = " + b);
Hope it well help you army
Similar questions