添加埃及分数js

This commit is contained in:
赵鑫 2023-02-19 14:40:18 +08:00
parent 666a097850
commit 1a759ed1ac

9
埃及分数.js Normal file
View File

@ -0,0 +1,9 @@
const process = require("process");
let a = process.argv[2];
let b = process.argv[3];
const gcd = (a, b) => (b ? gcd(b, a % b) : a);
const scm = (a, b) => (a * b) / gcd(a, b);
console.log(gcd(a, b));