From fa70c36d2015e615cb4025ac385a56852f8938f3 Mon Sep 17 00:00:00 2001 From: meng-lingkun <1725116698@qq.com> Date: Mon, 12 Apr 2021 18:52:52 +0800 Subject: [PATCH] zxc --- .../Dream2.java" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "\346\225\260\347\273\204\347\273\203\344\271\240/\345\255\237\344\273\244\345\235\244/Dream2.java" diff --git "a/\346\225\260\347\273\204\347\273\203\344\271\240/\345\255\237\344\273\244\345\235\244/Dream2.java" "b/\346\225\260\347\273\204\347\273\203\344\271\240/\345\255\237\344\273\244\345\235\244/Dream2.java" new file mode 100644 index 0000000..dad1c61 --- /dev/null +++ "b/\346\225\260\347\273\204\347\273\203\344\271\240/\345\255\237\344\273\244\345\235\244/Dream2.java" @@ -0,0 +1,34 @@ +package Day01; + +import java.time.chrono.MinguoChronology; +import java.util.Scanner; + +public class Dream2 { + + public static void main(String[] args) { + // TODO Auto-generated method stub + int[] a = new int[6]; + Scanner sc = new Scanner(System.in); + + for (int i = 0; i < a.length; i++) { + System.out.println("第" + (i + 1) + "位评委打分"); + a[i] = sc.nextInt(); + } + int max = a[0]; + int min = a[0]; + int sum = a[0]; + for (int i = 0; i < a.length; i++) { + if (max < a[i]) { + max = a[i]; + } + if (min > a[i]) { + min = a[i]; + } + sum += a[i]; + } + System.out.println("最高分:" + max); + System.out.println("最低分:" + min); + System.out.println("平均分:" + ((sum - max - min) / 4)); + } + +} -- Gitee