-
프로그래머스 - 평균 구하기 [자바]Algorithms/- 프로그래머스 2022. 2. 17. 01:19
- 문제 링크 : 평균 구하기
정답(Solution)
class Solution { public double solution(int[] arr) { double answer = 0; double sum = 0; for(int num : arr){ sum += num; } answer = sum / arr.length; return answer; } }
분석
- 단순사칙 연산
- double 자료형 아는지 묻는 문제
반응형