Skip to content

Commit cd33f7c

Browse files
author
Christian Bender
authored
Merge pull request TheAlgorithms#57 from christianbender/changed_euclian
added the let-statment
2 parents 78860e0 + 51b6420 commit cd33f7c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Algorithms/EucledianGCD.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function euclideanGCDRecursive (first, second) {
55
:param second: Second number
66
:return: GCD of the numbers
77
*/
8-
if (second === 0) {
8+
if (second == 0) {
99
return first;
1010
} else {
1111
return euclideanGCDRecursive(second, (first % second));
@@ -19,17 +19,17 @@ function euclideanGCDIterative (first, second) {
1919
:param second: Second number
2020
:return: GCD of the numbers
2121
*/
22-
while (second !== 0) {
23-
var temp = second;
22+
while (second != 0) {
23+
let temp = second;
2424
second = first % second;
2525
first = temp;
2626
}
2727
return first;
2828
}
2929

3030
function main () {
31-
var first = 20;
32-
var second = 30;
31+
let first = 20;
32+
let second = 30;
3333
console.log('Recursive GCD for %d and %d is %d', first, second, euclideanGCDRecursive(first, second));
3434
console.log('Iterative GCD for %d and %d is %d', first, second, euclideanGCDIterative(first, second));
3535
}

0 commit comments

Comments
 (0)