Write a program to input two unequal numbers. Display the numbers after swapping their values in the variables without using a third variable. Sample input: a=23,b=56
Sample output: a=56,b=23
Answers
Answered by
34
Answer:
import java.util.scanner;
public class SwapNumber
{
public static void main (String args [ ] )
{
Scanner in = new Scanner(System.in);
System.out.print ("Enter A value : ");
int a = in.nextInt( );
first number = first number + second number;
second number = first number - second number;
first number = first number - second number;
System.out.println ("Number after swapping .....");
System.out.println ("A="+a/t "B="+b);
}
}
Explanation:
Hope it helps you.....
Answered by
20
hope it helpful for you
Mark me in brainiliest
Attachments:
Similar questions