From 5c1ef85b934ab120bdfdc9237f4855954f861a23 Mon Sep 17 00:00:00 2001 From: yeongjun Kim Date: Sun, 23 Apr 2023 18:39:24 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=A9=EC=84=B1=EC=88=98=20=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/exam58.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Programmers/exam58.js diff --git a/Programmers/exam58.js b/Programmers/exam58.js new file mode 100644 index 0000000..c2bec5a --- /dev/null +++ b/Programmers/exam58.js @@ -0,0 +1,15 @@ +function solution(n) { + let answer = 0; + for (let i = 1; i <= n; i++) { + let cnt = 0; + for (let j = 1; j <= i; j++) { + if (i % j === 0) { + cnt++; + } + } + if (cnt >= 3) { + answer++; + } + } + return answer; +}