int sum=0; 을 스캐너 아래에 썼더니 런탐에러가 떴다.
소스
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
public class Main {
public static void main(String[] args) {
int sum = 0;
Scanner scan = new Scanner(System.in);
int[] a = new int[5];
for(int i=0; i<5; i++) {
a[i] = scan.nextInt();
if(a[i]<40){
a[i]=40;
}
sum = sum+a[i];
}
int avg = sum/5;
System.out.println(avg);
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'알고리즘 > Java' 카테고리의 다른 글
(JAVA) 백준 알고리즘 5단계 10817번 : 세 수 (0) | 2020.04.19 |
---|---|
(JAVA) 백준 알고리즘 5단계 5543번 : 상근날드 (0) | 2020.04.19 |
(JAVA) 백준 알고리즘 4단계 1110번 : 더하기 사이클 (0) | 2020.04.18 |
(JAVA) 백준 알고리즘 4단계 10951번 : A + B - 4 (0) | 2020.04.17 |
(JAVA) 백준 알고리즘 4단계 10952번 : A + B - 5 (0) | 2020.04.17 |