Computer
Write a program to input two unequal numbers. Display the numbers after swapping their values in the variables without using a third variable.
Answers
Answered by
5
Answer:
import java. util.*;
class swap
{
public static void main(String args[])
{
Scanner sc=new Scanner (System. in);
System.out.println("Enter two number ");
int a=sc.nextInt( );
int b=sc.nextInt( );
a=a+b;
b=a-b;
a=a-b;
System.out.println("swapped number of a: "+b);
System.out.println("swapped number of b: "+a);
}
}
Hope it helps you......
please mark it as brainliest
........
Similar questions