mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
find_lcm.js: Standardjs fixes (#146)
This commit is contained in:
@ -13,21 +13,21 @@
|
||||
|
||||
// Find the LCM of two numbers.
|
||||
function findLcm (num1, num2) {
|
||||
var max_num
|
||||
var maxNum
|
||||
var lcm
|
||||
// Check to see whether num1 or num2 is larger.
|
||||
if (num1 > num2) {
|
||||
max_num = num1
|
||||
maxNum = num1
|
||||
} else {
|
||||
max_num = num2
|
||||
maxNum = num2
|
||||
}
|
||||
lcm = max_num
|
||||
lcm = maxNum
|
||||
|
||||
while (true) {
|
||||
if ((lcm % num1 === 0) && (lcm % num2 === 0)) {
|
||||
break
|
||||
}
|
||||
lcm += max_num
|
||||
lcm += maxNum
|
||||
}
|
||||
return lcm
|
||||
}
|
||||
|
Reference in New Issue
Block a user