Mistři v programování na #hovnokod

Java #376

Najdete maximum a minimum

 public static void main(String[] args) {  
        int a, b, c, d, e, max = 0, min  = 0;  
        Scanner keyboard = new Scanner(System.in);  
                
        System.out.println ("Enter five numbers") ;  
        a = keyboard.netxtInt ();  
        b = keyboard.netxtInt ();  
        c = keyboard.netxtInt ();          
        d = keyboard.netxtInt ();          
        e = keyboard.netxtInt ();  
         
        if (a > b && a > c && a > d && a > e)  
            max = a ;  
        else if (b > a && b > c && b > d && b > e)  
            max = b ;  
        else if (d > a && d > b && d > c && d > e)  
            max = d ;  
        else if (c > a && c > b && c > d && c > e)  
            max = c ;  
        else if (d > a && d > b && d > c && d > e)  
            max = d ;  
        else if (e > a && e > b && e > c && e > d)  
            max = e ;  
        System.out.println("the maximum number is" + max);  
          
       if (a < b && a < c && a < d && a < e)  
            min = a ;  
        else if (b < a && b < c && b < d && b < e)  
            min = b ;  
        else if (d < a && d < b && d < c && d < e)  
            min = d ;  
        else if (c < a && c < b && c < d && c < e)  
            min = c ;  
        else if (d < a && d < b && d < c && d < e)  
            min = d ;  
        else if (e < a && e < b && e < c && e < d)  
            min = e ;  
          
        System.out.println("the minimum number is" + min);  
    }  

Anonymous,