import java.util.Scanner;
public class a1 {
public static void main(String[] args) {
Scanner myScanner = new Scanner(System.in);
double total = 0;
int passNum = 0;
for (int j = 1;j <= 3;j++) {
double sum = 0;
for (int i = 1; i <= 5; i++) {
System.out.println("请输入第" + j + "班第" + i + "个同学的成绩");
double score = myScanner.nextDouble();
if (score >= 60) {
passNum++;
}
System.out.println("成绩为 " + score);
sum += score;
}
System.out.println("第" + j +"班的平均分为 " + (sum / 5));
total += sum;
System.out.println("======================");
}
System.out.println("所有班级的平均分为 " + (total / 15));
System.out.println("三个班及格人数为 " + passNum);
}
}
java学习p135
最新推荐文章于 2024-09-27 00:45:01 发布