💻
class Solution {
public int solution(int n) {
int answer = 0;
for(int i=1; i<=n; i++)
{
if (n % i == 0)
{
answer += i;
}
}
return answer;
}
}
'프로그래머스 > Lv.1' 카테고리의 다른 글
[프로그래머스 C#] 수박수박수박수박수박수? (0) | 2023.08.29 |
---|---|
[프로그래머스 C#] 정수 내림차순으로 배치하기 (0) | 2023.08.28 |
[프로그래머스 C#] 나머지가 1이 되는 수 찾기 (0) | 2023.08.27 |
[프로그래머스 C#] 직사각형 별찍기 (0) | 2023.08.23 |
[프로그래머스 C#] x만큼 간격이 있는 n개의 숫자 (0) | 2023.08.23 |