Computer Science, asked by srivastavavinay03, 1 month ago

Write a program to make a suitable class to input two integers. Interchange the integers
Print integers before and after interchange with suitable message.​

Answers

Answered by swathimai2125
1

Answer:

Java Program

import java.util.*;

class Swap_With {

public static void main(String[] args) {

int x, y, t;// x and y are to swap.

Scanner sc = new Scanner(System.in);

System.out.println("Enter the value of X and Y");

x = sc.nextInt();

y = sc.nextInt();

Explanation:

Answered by safashamon567
4

import java.util.*;

public class numbers

{

   public void interchange()

   {

       int n1,n2;

       Scanner Sc = new Scanner(System.in);

       System.out.println("Enter two integers");

       n1 = Sc.nextInt();

       n2 = Sc.nextInt();

       int temp = n1;

       n1 = n2;

       n2 = temp;

       System.out.println("The Integers after interchange = "+n1+"\t"+n2);

   }

}

Similar questions