find max and min from 1-day array having n element

public class Maximum {
    public static void main(String []args){

        int a[] = {10,33,55,555, 7763};
        int min = n[0];
        int max = n[0];
        for(int i=0; i<a.length; i++){
            if(n[i] > max) {
            max = a[i];
        }
            if(n[i] < min) {
            min=n[i];
        }
    }
        System.out.println("max value "  + max);
        System.out.println("min value "  + min);
    }
    
}

Add a Comment

Your email address will not be published. Required fields are marked *