解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int[] x=new int[n];
int a = 0, b = 0, c = 0, d = 0, e = 0;
for (int i = 0; i < x.length; i++) {
x[i]=sc.nextInt();
}
for (int i = 0; i < x.length; i++) {
if (x[i]>= 90) {
a ++;
} else if (x[i]>= 80 && x[i]< 90) {
b ++;
} else if (x[i]>= 70 && x[i]< 80) {
c ++;
} else if (x[i]>= 60 && x[i]< 70) {
d ++;
} else {
e ++;
}
}
int m=sc.nextInt();
switch (m){
case 1: System.out.println(a);break;
case 2: System.out.println(b);break;
case 3: System.out.println(c);break;
case 4: System.out.println(d);break;
case 5: System.out.println(e);break;
}
}
}
0.0分
0 人评分
IP判断 (C语言代码)浏览:920 |
C语言考试练习题_排列 (C++代码)浏览:628 |
C语言训练-立方和不等式 (C语言代码)浏览:742 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)for循环浏览:1101 |
printf基础练习2 (C语言代码)浏览:740 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:590 |
A+B for Input-Output Practice (V) (C语言代码)浏览:617 |
母牛的故事 (C语言代码)浏览:1427 |
幸运数 (C++代码)浏览:1258 |
1048题解(读入回车问题)浏览:554 |