Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Algorithms/EucledianGCD.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function euclideanGCDRecursive (first, second) {
:param second: Second number
:return: GCD of the numbers
*/
if (second === 0) {
if (second == 0) {
return first;
} else {
return euclideanGCDRecursive(second, (first % second));
Expand All @@ -19,17 +19,17 @@ function euclideanGCDIterative (first, second) {
:param second: Second number
:return: GCD of the numbers
*/
while (second !== 0) {
var temp = second;
while (second != 0) {
let temp = second;
second = first % second;
first = temp;
}
return first;
}

function main () {
var first = 20;
var second = 30;
let first = 20;
let second = 30;
console.log('Recursive GCD for %d and %d is %d', first, second, euclideanGCDRecursive(first, second));
console.log('Iterative GCD for %d and %d is %d', first, second, euclideanGCDIterative(first, second));
}
Expand Down