-
[JAVA] CodingTest 문제1번 - ex2카테고리 없음 2022. 11. 8. 17:44
public class main01 {
public static void main(String[] args)
{
int [][] allScores = {
{88,74,78,90,54},
{78,43,30,90,54},
{74,38,92,98,33}
};
int total = 0;
double avg;
int cnt = 0;for(int i = 0; i < allScores.length; i++) {
for(int j = 0; j< allScores[i].length; j++) {
total += allScores[i][j];
cnt++;
}
}
avg = (double)total / cnt;
System.out.println("평균 점수는"+avg+"입니다.");System.out.println("평균보다 높은 점수는");
for(int i = 0; i < allScores.length; i++) {
for(int j = 0; j< allScores[i].length; j++) {if(allScores[i][j]>avg) {
System.out.plrint(allScores[i][j]+", ");
}
}
}
System.out.println("입니다.");
}
}