- public class Sort {
- public static void main(String[] args) {
- int[]arr = {1,4,5,10,9};
- int min=arr[0], max=arr[0]=0,sum=0;
- for(int a:arr){
- sum+=a;
- if(a<min)
- min=a;
- if(a>max)
- max=a;
- }
- // System.out.println(max);
- // System.out.println(min);
- System.out.println((sum-min-max)/(double)(arr.length-2));
- }
- }
复制代码
|