|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package day_06;
public class test {
public static void main(String[] args) {
int[] scoreArr= null;
int total= 0; //총점 누적
double avg= 0; // 평균 저장
scoreArr= new int[]{85,90,100,75,90};
/*
scoreArr[0]= 85;
scoreArr[1]= 90;
scoreArr[2]= 100;
scoreArr[3]= 75;
scoreArr[4]= 90;
*/
// 토탈값 구하기
for(int i=0; i<scoreArr.length; i++) { //
total += scoreArr[i];
}
avg= total/scoreArr.length;
System.out.printf("avg: "+avg , "total: "+total);
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |