public class Solution {
public double solution(int[] arr) {
double answer = 0;
int a = 0;
for(int i = 0; i<arr.Length; i++)
{
a += arr[i];
answer = (double)a / arr.Length;
}
return answer;
}
}
728x90
'프로그래머스 문제풀이' 카테고리의 다른 글
프로그래머스 Level 1 : 최대공약수와 최소공배수 (0) | 2020.07.01 |
---|---|
프로그래머스 Level 1 : 짝수와 홀수 (0) | 2020.06.29 |
프로그래머스 Level 1 : 나누어 떨어지는 숫자 배열 (0) | 2020.06.29 |
프로그래머스 Level 1 : 문자열 내림차순으로 배치하기 (0) | 2020.06.28 |
프로그래머스 Level1 : 문자열 다루기 기본 (0) | 2020.06.28 |