Thursday, 13 June 2013

program for check large number in between two numbers

import java.io.*;
class simple_check_large_of_2_num
{
    public static void main(String args[])
    {
        try
        {
            int a,b;
            DataInputStream cin=new DataInputStream(System.in);
            System.out.println("Enter nuber to check it possitive or negative");
            a=Integer.parseInt(cin.readLine());
            System.out.println("Enter nuber to check it possitive or negative");
            b=Integer.parseInt(cin.readLine());
            if(a>b)
            {
                System.out.println(a+" is large than "+b);
            }
            else
            {
                System.out.println(b+" is large than "+a);
            }
        }
        catch(Exception e)
        {
            System.out.println("Wrong data");
        }
    }
}

No comments: