import java.util.Scanner;
public class Swap
{
public static void main(String[]hjk)
{
int a,b;
Scanner s1=new Scanner(System.in);
System.out.println("enter first num as a");
a=s1.nextInt();
Scanner s2=new Scanner(System.in);
System.out.println("enter second num as b");
b=s2.nextInt();
a=a+b;
b=a-b;
a=a-b;
System.out.println("the swapped num are");
System.out.println("a="+a);
System.out.println("b="+b);
}
}
No comments:
Post a Comment