import java.util.Arrays; public class Main { public static void main(String[] args) { int[][] scores = { { 82, 90, 91 }, { 68, 72, 64 }, { 95, 91, 89 }, { 67, 52, 60 }, { 79, 81, 85 }, }; double sum = 0; int length = scores[0].length * scores.length; for(int [] arrs:scores){ for(int arr:arrs){ sum += arr; } } double average = sum/length; System.out.printf("全班平均成绩为%.2f分\n",average); if (Math.abs(average - 77.733333) < 0.000001) { System.out.println("测试成功"); } else { System.out.println("测试失败"); } } }
Sign in to make a reply
_我是来微博看美女的