From ad75542cbd06539ed9d45f0dfd051dad3d99af1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E6=A2=A6=E6=9E=97?= <2777141796@qq.com> Date: Wed, 14 Apr 2021 19:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AB=E5=98=8E=E9=9B=85=E9=B9=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ml01.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Ml01.java diff --git a/Ml01.java b/Ml01.java new file mode 100644 index 0000000..c0d0b89 --- /dev/null +++ b/Ml01.java @@ -0,0 +1,53 @@ +import java.util.Scanner; + +public class Ml01 { + + public static void main(String[] args) { + //- 需求:在编程竞赛中,有6个评委为参赛的选手打分,分数为0-100的整数分。 + // 选手的最后得分为:去掉一个最高分和一个最低分后 的4个评委平均值 (不考虑小数部分)。 + +//- 思路: +//1.定义一个数组,用动态初始化完成数组元素的初始化,长度为6 +//2.键盘录入评委分数 +//3.由于是6个评委打分,所以,接收评委分数的操作,用循环 +//4.求出数组最大值 +//5.求出数组最小值 +//6.求出数组总和 +//7.按照计算规则进行计算得到平均分 +//8.输出平均分 + + + Scanner scan = new Scanner(System.in); + + int [] age = new int[6]; + int sum = 0; + + System.out.println("请输入评委给的我分数" ); + + for(int i =0 ; imax ) { + max=age[i]; + + } + if( age[i]