package com.hnsw.Tesr02; import java.util.Scanner; public class MuIForExercise01 { public static void main(String[] args) { Scanner in = new Scanner(System.in); double score = 0; double sum1 = 0; int passsum = 0; for (int i = 1; i <= 3; i++){ double sum = 0; for (int a = 1; a <= 5; a++){ System.out.println("请输入" + i + "班第" + a + "门成绩"); score =in.nextInt(); if(score >= 60){ passsum++; } sum += score; sum1 += score; System.out.println("成绩为" + score); } System.out.println("总分为" + sum +"平均分为" + (sum / 5)); System.out.println("60分以上有" + passsum); } System.out.println(sum1 / (3 * 5)); } }
(从键盘输入)算五个班的各个班平均值再算所有班的平均值60分的有几个
最新推荐文章于 2023-11-18 19:34:05 发布