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-11 03:45:55
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));