package practice;
import java.util.Scanner;
public class practicedemo5 {
// 目标:6个评委打分,求最大值,最小值,去掉最值后的总平均分
public static void main(String[] args) {
//1.输入对应评委的评分
int[] arr=new int[6];
Scanner sc=new Scanner(System.in);
for (int i = 0; i <arr.length; i++) {
System.out.println("请输入第"+(i+1)+"个评委的分数:");
arr[i]=sc.nextInt();
}
//2.计算去最值后的总平均分,及最值
int max=arr[0];
int min=arr[0];
double sum=0;
for (int i = 0; i < arr.length; i++) {
if(arr[i]>max){
max=arr[i];
}
if(arr[i]<min){
min=arr[i];
}
sum=sum+arr[i];
}
System.out.println("最大值:"+max);
System.out.println("最小值:"+min);
System.out.println("均值:"+(sum-max-min)/(arr.length-2));
}
}