Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 33129f0

Browse filesBrowse files
committed
Add Euclidean GCD algo
1 parent 1f0be4b commit 33129f0
Copy full SHA for 33129f0

File tree

1 file changed

+10
-0
lines changed
Filter options

1 file changed

+10
-0
lines changed

‎JavaScript/9-gcd.js

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
const gcd = (a, b) => {
4+
if (b === 0) return a;
5+
return gcd(b, a % b);
6+
};
7+
8+
// const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));
9+
10+
console.log(gcd(12, 78));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.