From b8d1f7e87475951fa67e2fddef910a7aa96083f9 Mon Sep 17 00:00:00 2001 From: rl544 <111494264+rl544@users.noreply.github.com> Date: Fri, 9 Dec 2022 17:45:04 +0900 Subject: [PATCH] =?UTF-8?q?uploaded=20at=202022.=2012.=209.=20=EC=98=A4?= =?UTF-8?q?=ED=9B=84=205:45:02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- programmers/약수의 합/solution.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 programmers/약수의 합/solution.java diff --git a/programmers/약수의 합/solution.java b/programmers/약수의 합/solution.java new file mode 100644 index 0000000..b9d6b71 --- /dev/null +++ b/programmers/약수의 합/solution.java @@ -0,0 +1,11 @@ +// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/12928 + +class Solution { + public int solution(int n) { + int answer = 0; + for (int i = 1; i <= n; i++){ + answer += (n%i==0) ? i : 0; + } + return answer; + } +} \ No newline at end of file