공부하시는대에 도움이 됐으면 좋겠습니다.
답안코드 확인해주세요!
더보기
public class Q {
public static void main(String[] args) {
String[] name = {"kim","lee","hong","song","park"};
int [][]score = { { 85, 60, 70, 0 ,0},
{90 ,95, 80, 0, 0},
{75, 80 ,60 ,0,0},
{80, 70 ,95 ,0,0},
{100, 65 ,80 ,0,0},
};
int r,c;
System.out.println("이름\t국어\t영어\t수학\t합계\t평균");
for( r=0;r<name.length;r++) {
System.out.print(name[r]+":\t");
for(c=0;c<3;c++) {
score[r][3] += score[r][c];
System.out.print(score[r][c]+"\t");
}
score[r][4] = score[r][3]/3;
System.out.println(score[r][3] + "\t" + score[r][4]);
}
}
}
댓글