약수의 합

han.user();·2023년 4월 12일
0

프로그래머스

목록 보기
55/87
post-thumbnail

class Solution {
    public int solution(int n) {
       int count = 0;

        for (int i = 1; i <= n; i++) {
            if (n % i == 0) {
                count+=i;
            }
        }
        return count;
    }
}
profile
I'm still hungry.

0개의 댓글