find_lcm.js: Standardjs fixes (#146)

This commit is contained in:
Christian Clauss
2020-05-04 17:23:38 +02:00
committed by GitHub
parent 5511405bd9
commit d53c1129b6

View File

@ -13,21 +13,21 @@
// Find the LCM of two numbers. // Find the LCM of two numbers.
function findLcm (num1, num2) { function findLcm (num1, num2) {
var max_num var maxNum
var lcm var lcm
// Check to see whether num1 or num2 is larger. // Check to see whether num1 or num2 is larger.
if (num1 > num2) { if (num1 > num2) {
max_num = num1 maxNum = num1
} else { } else {
max_num = num2 maxNum = num2
} }
lcm = max_num lcm = maxNum
while (true) { while (true) {
if ((lcm % num1 === 0) && (lcm % num2 === 0)) { if ((lcm % num1 === 0) && (lcm % num2 === 0)) {
break break
} }
lcm += max_num lcm += maxNum
} }
return lcm return lcm
} }