Computer Science, asked by chandhrakumar494, 5 months ago

write a Java program to input two numbers from the users, display the numbers after swapping them by using third variable.
Eg: input: a=12, b=21. Output: a=21, b=12​

Answers

Answered by thesecondarcreactor2
3

import java.util.*;

public class SwapNumbers

{

 public static void main(String[] args)

{

      Scanner sc=new Scanner(System.in);

int a,b,c:

System.out.println("Enter Two numbers.");

a=sc.nextInt();

b=sc.nextInt();

System.out.println("Numbers before swapping:-"+a+"and"+b);

c=a;

a=b;

b=c;

System.out.println("Numbers after swapping:-"+a+"and"+b);

}

}

PLease mark as brainliest.

Similar questions