[Algorithm] 순서쌍의 개수

yeah·2023년 10월 19일

Algorithm

목록 보기
18/27
post-thumbnail

Mission.

작성한 답

function solution(n) {
    let count = 0; // 자연수 순서쌍의 개수를 저장할 변수
    for (let a = 1; a <= n; a++) {
        if (n % a === 0) {
            let b = n / a;
            count++;
        }
    }
    return count;
}

참고 자료

https://school.programmers.co.kr/learn/courses/30/lessons/120836

profile
기록과 회고

0개의 댓글