From 1fbb2540b37548aae52e2348ced509d2572a72aa Mon Sep 17 00:00:00 2001 From: cai-zongzhen <2404985661@qq.com> Date: Tue, 13 Apr 2021 18:31:33 +0800 Subject: [PATCH] first commit --- .../Demo.java" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 "\346\225\260\347\273\204\347\273\203\344\271\240/\350\224\241\345\256\227\351\225\207/Demo.java" diff --git "a/\346\225\260\347\273\204\347\273\203\344\271\240/\350\224\241\345\256\227\351\225\207/Demo.java" "b/\346\225\260\347\273\204\347\273\203\344\271\240/\350\224\241\345\256\227\351\225\207/Demo.java" new file mode 100644 index 0000000..aa21859 --- /dev/null +++ "b/\346\225\260\347\273\204\347\273\203\344\271\240/\350\224\241\345\256\227\351\225\207/Demo.java" @@ -0,0 +1,44 @@ +package da; + +import java.util.Scanner; + +public class Demo { + + public static void main(String[] args) { + Scanner sc=new Scanner(System.in); + int a[]=new int[6]; + + for (int i = 0; i < a.length; i++) { + System.out.println("请为选手打分"); + a[i]=sc.nextInt(); + } + for (int i = 0; i < a.length; i++) { + System.out.print(a[i]); + System.out.print(" "); + } + int max=a[0]; + int min=a[0]; + int sum=0; + for (int i = 0; i < a.length; i++) { + if (maxa[i]) { + min=a[i]; + } + } + for (int i = 0; i < a.length; i++) { + if ((a[i]==max)||(a[i]==min)) { + + } + else { + sum+=a[i]; + } + } + System.out.println(); + System.out.println("平均值为:"+sum/4); + } + +} -- Gitee