Skip to content

Commit 3d4ebda

Browse files
committed
Added more examples for gcd
1 parent 3aa6c51 commit 3d4ebda

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

public/consolidated/javascript.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@
376376
"division"
377377
],
378378
"contributors": [],
379-
"code": "function gcd(a, b) {\n while (b !== 0) {\n let temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n}\n\n// Usage\ngcd(1920, 1080); // Returns: 120\n"
379+
"code": "function gcd(a, b) {\n while (b !== 0) {\n let temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n}\n\n// Usage\ngcd(1920, 1080); // Returns: 120\ngcd(1920, 1200); // Returns: 240\ngcd(5,12); // Returns: 1\n"
380380
}
381381
]
382382
},

snippets/javascript/mathematical-functions/greatest-common-divisor.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ function gcd(a, b) {
1616
}
1717

1818
// Usage
19-
gcd(1920, 1080); // Returns: 120
19+
gcd(1920, 1080); // Returns: 120
20+
gcd(1920, 1200); // Returns: 240
21+
gcd(5,12); // Returns: 1
2022
```

0 commit comments

Comments
 (0)