프로그래머스/LV.0
-
분수의 덧셈프로그래머스/LV.0 2024. 5. 14. 04:43
class Solution { public int[] solution(int numer1, int denom1, int numer2, int denom2) { int[] answer = new int[2]; int denom = denom1*denom2; int numer = (numer1*denom2) + (numer2*denom1); int GCD2 = GCD(numer, denom); answer[0]= numer/GCD2; answer[1] = denom/GCD2; return answer; } ..