숫자 A, LCM 및 GCD 값이 있다고 가정하면 다른 숫자 B를 찾아야 합니다. A =5, LCM은 25, HCF =4이면 다른 숫자는 4가 됩니다. −
$$𝐴∗𝐵=𝐿𝐶𝑀∗𝐻𝐶𝐹$$
$$𝐵=\frac{LCM*HCF}{A}$$
예시
#include <iostream>
using namespace std;
int anotherNumber(int A, int LCM, int GCD) {
return (LCM * GCD) / A;
}
int main() {
int A = 5, LCM = 25, GCD = 4;
cout << "Another number is: " << anotherNumber(A, LCM, GCD);
} 출력
Another number is: 20