import java.io.*;
class simple_swapping_of_2_numbers
{
public static void main(String args[])
{
try
{
int a,b,c;
DataInputStream cin=new DataInputStream(System.in);
System.out.println("enter the two number for a and b");
a=Integer.parseInt(cin.readLine());
b=Integer.parseInt(cin.readLine());
System.out.println("a = "+a);
System.out.println("b = "+b+"\n");
c=a;
a=b;
b=c;
System.out.println("a = "+a);
System.out.println("b = "+b);
}
catch(Exception e)
{
System.out.println("wrong data");
}
}
}
No comments:
Post a Comment