predict the output of :
import java.util.Scanner;
public class Swap
{ public static void main(String args[]) { Scanner in = new Scanner(System.in); 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("The value of a= " + a); System.out.println("The value of b= " + b); } }
Answers
Answered by
2
Suppose,
a = 2
b = 5
OUTPUT
Enter first number : 2
Enter second number : 3
The value of a = 5
The value of b = 2
Similar questions
Math,
2 days ago
Physics,
2 days ago
Social Sciences,
2 days ago
Math,
4 days ago
India Languages,
4 days ago
Math,
8 months ago
History,
8 months ago
Accountancy,
8 months ago