import java.io.*;
class swap
{
public static void main(String s[]) throws IOException
{
int a=0,b=0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter value of a : ");
a = Integer.parseInt(br.readLine());
System.out.print("Enter value of b : ");
b = Integer.parseInt(br.readLine());
System.out.println("Before Swaping");
System.out.println("a = "+a);
System.out.println("b = "+b);
a=a*b;
b=a/b;
a=a/b;
System.out.println("After Swaping");
System.out.println("a = "+a);
System.out.println("b = "+b);
}
}
save as swap.java
class swap
{
public static void main(String s[]) throws IOException
{
int a=0,b=0;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter value of a : ");
a = Integer.parseInt(br.readLine());
System.out.print("Enter value of b : ");
b = Integer.parseInt(br.readLine());
System.out.println("Before Swaping");
System.out.println("a = "+a);
System.out.println("b = "+b);
a=a*b;
b=a/b;
a=a/b;
System.out.println("After Swaping");
System.out.println("a = "+a);
System.out.println("b = "+b);
}
}
save as swap.java
Author :

0 comments:
Post a Comment