public class Test {
public static void main(String[] args) {
int score[][] = {{89,66,54},{77,93,68},{55,45,88},{71,76,75}};
double avg = 0 ;
int sum = 0;
for(int i = 0;i < score.length;i++){
for (int j = 0; j < score[i].length; j++) {
sum += score[i][j];
}
}
avg = sum/12;
for(int i = 0;i < score.length;i++){
for (int j = 0; j < score[i].length; j++) {
if(score[i][j] < avg){
System.out.println("[" + i + "," + j + "]");
}
}
}
}
}
|