Thursday, January 9, 2014

Program to display great and small number from the given three numbers.

import java.util.*;
class grtsmlNO
{
    public static void main(String surat[])
    {
        Scanner n=new Scanner(System.in);
        System.out.println("Enter the Number : ");
        int a=n.nextInt();
        int b=n.nextInt();
        int c=n.nextInt();
        int great,small;
   
        if((a>b) && (a>c))
            great=a;
        else if((b>a) && (b>c))
            great=b;
        else
            great=c;
        System.out.println("The great Number Is : "+great);
   
        if((a<b) && (a<c))
            small=a;
        else if((b<a) && (b<c))
            small=b;
        else
            small=c;
        System.out.println("The small Number Is : "+small);
    }
}

Output:

No comments:

Post a Comment