find_lcm.js: Standardjs fixes

This commit is contained in:
Christian Clauss
2020-05-04 16:38:28 +02:00
committed by GitHub
parent 315be0e413
commit a90b487ae7

View File

@ -12,19 +12,19 @@
'use strict' 'use strict'
// Find the LCM of two numbers. // Find the LCM of two numbers.
function find_lcm (num_1, num_2) { function findLcm (num1, num2) {
var max_num var max_num
var lcm var lcm
// Check to see whether num_1 or num_2 is larger. // Check to see whether num1 or num2 is larger.
if (num_1 > num_2) { if (num1 > num2) {
max_num = num_1 max_num = num1
} else { } else {
max_num = num_2 max_num = num2
} }
lcm = max_num lcm = max_num
while (true) { while (true) {
if ((lcm % num_1 === 0) && (lcm % num_2 === 0)) { if ((lcm % num1 === 0) && (lcm % num2 === 0)) {
break break
} }
lcm += max_num lcm += max_num
@ -32,7 +32,7 @@ function find_lcm (num_1, num_2) {
return lcm return lcm
} }
// Run `find_lcm` Function // Run `findLcm` Function
var num_1 = 12 var num1 = 12
var num_2 = 76 var num2 = 76
console.log(find_lcm(num_1, num_2)) console.log(findLcm(num1, num2))