function gcd(a,b){ return b == 0 ? a : gcd(b,a%b); } function lcm(a,b){ return a * b / gcd(a,b); } console.log(gcd(24,42)); console.log(lcm(16,36));
时间: 2024-10-29 19:08:29
function gcd(a,b){ return b == 0 ? a : gcd(b,a%b); } function lcm(a,b){ return a * b / gcd(a,b); } console.log(gcd(24,42)); console.log(lcm(16,36));