Computer Science, asked by madhupatwari24, 7 months ago

write a program in java to accept two numbers and print them after interchanging their values​

Answers

Answered by arsha24
1

Explanation:

public class Swap_Integers.

int m, n, temp;

Scanner s = new Scanner(System.

System. out. print("Enter the first number:");

m = s. nextInt();

System. out. print("Enter the second number:");

n = s. nextInt();

temp = m;

Answered by llɱissMaɠiciaŋll
11

Explanation:

Java Program

  1. import java.util.*;
  2. class Swap_With {
  3. public static void main(String[] args) {
  4. int x, y, t;// x and y are to swap.
  5. Scanner sc = new Scanner(System.in);
  6. System.out.println("Enter the value of X and Y");
  7. x = sc.nextInt();
  8. y = sc.nextInt();
Attachments:
Similar questions