/*
*4、定义一个数组来存储12个学生的成绩{72,89,65,58,87,91,53,82,71,93,76,68},
* 计算并输出学生的平均成绩。
*
* */
public class arr_ScoreAge {
public static void main(String[] args) {
int[] a = {72, 44, 77, 88, 99, 56, 99};
int sum = 0;
for (int i = 0; i < a.length; i++){
sum+=a[i];
}
int x =0;
x = sum / a.length;
System.out.println("平均数:" +x);
}
}
谢码主:慎独W 谢谢