import java.util.*;
class Swap
{
public static void main(String args[])
{
int a,b,temp;
Scanner sc = new Scanner(System.in);
System.out.println("Enter two integers:");
a=sc.nextInt();
b=sc.nextInt();
System.out.println("Before swapping:\n a="+a+"\tb="+b);
temp=a;
a=b;
b=temp;
System.out.println("After swapping:\n a="+a+"\tb="+b);
}
}
class Swap
{
public static void main(String args[])
{
int a,b,temp;
Scanner sc = new Scanner(System.in);
System.out.println("Enter two integers:");
a=sc.nextInt();
b=sc.nextInt();
System.out.println("Before swapping:\n a="+a+"\tb="+b);
temp=a;
a=b;
b=temp;
System.out.println("After swapping:\n a="+a+"\tb="+b);
}
}
No comments :
Post a Comment