import java.util.Scanner;
public class Swapping
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int x,y,temp;
System.out.println("Please Enter the value of x:");
x=sc.nextInt();
System.out.println("The value of x :"+x);
System.out.println("Please Enter the value of y:");
y=sc.nextInt();
System.out.println("The value of y :"+y);
temp=x;
x=y;
y=temp;
// after Swapping
System.out.println("After Swapping,the value of x:" +x);
System.out.println("After Swapping,the value of y:" +y);
}
}
public class Swapping
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int x,y,temp;
System.out.println("Please Enter the value of x:");
x=sc.nextInt();
System.out.println("The value of x :"+x);
System.out.println("Please Enter the value of y:");
y=sc.nextInt();
System.out.println("The value of y :"+y);
temp=x;
x=y;
y=temp;
// after Swapping
System.out.println("After Swapping,the value of x:" +x);
System.out.println("After Swapping,the value of y:" +y);
}
}
No comments:
Post a Comment