From fa5930f890f00d2356923054751f590537c1e988 Mon Sep 17 00:00:00 2001 From: Shaurya Vats Date: Wed, 12 Oct 2022 20:32:56 +0530 Subject: [PATCH] Added gcd.js --- GCD/gcd.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 GCD/gcd.js diff --git a/GCD/gcd.js b/GCD/gcd.js new file mode 100644 index 0000000..c71394f --- /dev/null +++ b/GCD/gcd.js @@ -0,0 +1,3 @@ +const gcd = (a, b) => (a === b ? a : a > b ? gcd(a - b, b) : gcd(a, b - a)); + +console.log(`GCD of 15 and 20 is ${gcd(15, 20)}`); \ No newline at end of file