3μ₯ μ°μ°μ ~ 5μ₯ μ°Έμ‘° μλ£ν(λ°°μ΄)
for(int k: a) {
System.out.println(k);
}
λ°°μ΄ μ λͺ¨λ₯΄λ 건 λ§ν κ²λ μκ³ , ν΄λμ€, λ©μλ νΈμΆνλ κ²λ μμ§ μ λͺ¨λ₯΄κ² λ€. λ무 μ°λλ κΈ° μμ€μ΄λκΉ λͺ¨λ₯΄λ κ²λ§ μ°Ύμ§ λ§κ³ μμ μ±
μ λ€ μ λ
ν΄μΌκ² λ€... μ¬μ€ λ€ λͺ°λΌμ λͺ¨λ₯΄λ κ²λ§ μ°Ύλ μλ―Έκ° μμ.
public class Solution {
public int[] solution(int n, int m) {
int max = 0;
int max1 = 1;
for(int i=1; i<=n; i++) {
if(n%i ==0 && m%i ==0){
max1= i;
}
}
int[] answer = {max1, n*m/max1};
return answer;
}
}
23:24 νμ¬ μ΄μ νλ 'μλ μ«μ λνκΈ°' λ€μ νμ΄λ³΄λ μ€... μ΄κ±° λ€ λλλ©΄ μμν μμ .