[문제링크 - 프로그래머스 - 배열의 평균값] https://school.programmers.co.kr/learn/courses/30/lessons/120817
class Solution {
public double solution(int[] numbers) {
int sum = 0;
for(int i=0; i<numbers.length; i++){
sum += numbers[i];
}
double answer = (double)sum / numbers.length;
return answer;
}
}
class Solution1 {
public double solution(int[] numbers) {
return Arrays.stream(numbers).average().orElse(0); //null인 경우 0을 돌려줌
}
}