웅재의 코딩세상

[프로그래머스] 평균 구하기 본문

코딩테스트/프로그래머스 - LV 1

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

웅드 2024. 2. 9. 17:12

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

double solution(vector<int> arr) {
    double answer = 0;
    
    for(int i=0; i<arr.size(); i++){
        answer += arr[i];
    }
    return answer / arr.size();
}
반응형