-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex41.java
More file actions
42 lines (35 loc) · 767 Bytes
/
ex41.java
File metadata and controls
42 lines (35 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package mjl;
import java.util.Scanner;
public class ex41 {
public static void main(String[] args) {
Scanner input1 = new Scanner(System.in);
int n=input1.nextInt();
int m[]=new int[n];
Scanner s = new Scanner(System.in);
for(int i=0;i<n;i++)
{
m[i]=s.nextInt();
}
int bujige=0,jige=0,zhong=0,liang=0,you=0;
int k=0,sum=0;
for(int i=0;i<n;i++)
{
sum+=m[i];
if(m[k]<m[i])
k=i;
if(m[i]<60)
bujige++;
else if(m[i]<69)
jige++;
else if(m[i]<79)
zhong++;
else if(m[i]<89)
liang++;
else
you++;
}
System.out.println("最高分:"+m[k]);
System.out.println("平均分:"+sum/n);
System.out.println("不及格:"+bujige+" 及格:"+jige+" 中:"+zhong+" 良:"+liang+" 优:"+you);
}
}