프로그래머스 12928 약수의 합

1 개요[ | ]

프로그래머스 12928 약수의 합

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(int n) {
    int answer = 0;
    for(int i=1; i<=n; i++) {
        if(n%i==0) answer+=i;
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}