Skip to content

Commit 0d27d7f

Browse files
committed
Update 220425 나머지가-1이-되는-수-찾기.js
1 parent 8f3bcd1 commit 0d27d7f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

level-1/나머지가-1이-되는-수-찾기.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ function solution(n) {
2121
i++;
2222
}
2323
return answer;
24-
}
24+
}
25+
26+
//정답 3 - jaewon1676
27+
function solution(n) {
28+
var answer = 0;
29+
for (let i=1; i<n; i++){
30+
if(n%i === 1) return i // 나머지가 1이 되면 i를 출력합니다
31+
}
32+
return -1
33+
}
34+

0 commit comments

Comments
 (0)