Computer Science, asked by jhansitalathoti9, 4 months ago


The answers in this section should consist of the programs in either
Blue J environment or any Program environment with java as the
base.
Each program should be written using variable description. So that the
logic of the program is clearly depicted.
write a program to accept any two values swap (interchange) and print them on the screen (with the help of 3 variables)​

Answers

Answered by oraclerkumar
1

Answer:

Java code

Explanation:

public class Exercise15 {

public static void main(String[] args) {

int a, b, temp;

a = 15;

b = 27;

System.out.println("Before swapping : a, b = "+a+", "+ + b);

temp = a;

a = b;

b = temp;

System.out.println("After swapping : a, b = "+a+", "+ + b);

}

}

Similar questions