(프로그래머스) 나머지가 1이 되는 수 찾기

유지원·2022년 4월 8일
0

프로그래머스

목록 보기
22/66

문제 링크

https://programmers.co.kr/learn/courses/30/lessons/87389?language=javascript


Javascript

function solution(n, x = 1) {
	while (x++) {
		if (n % x === 1) {
			return x;
		}
	}
}
profile
👋 https://github.com/ujw0712

0개의 댓글