프로그래머스/Lv.1

[프로그래머스 C#] 평균 구하기

suniverse 2023. 8. 19. 13:51

 

💻

public class Solution {
    public double solution(int[] arr) {
        double answer = 0;
        double result = 0;
        
        for(int i = 0; i < arr.Length; i++)
        {
            result += arr[i];
        }
        
        answer = result / arr.Length;
        
        return answer;
    }
}