Skip to content

#프로그래머스 최대공약수와 최소공배수 #3

@jeongye01

Description

@jeongye01

class Solution {
public int[] solution(int n, int m) {
int[] answer = new int[2];
for (int i = 1; i < n + m; i++) {
if (n % i == 0 && m % i == 0) {
answer[0] = i;
answer[1] = n * m / answer[0];
}
}
return answer;
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions