File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 12
12
'use strict'
13
13
14
14
// Find the LCM of two numbers.
15
- function find_lcm ( num_1 , num_2 ) {
15
+ function findLcm ( num1 , num2 ) {
16
16
var max_num
17
17
var lcm
18
- // Check to see whether num_1 or num_2 is larger.
19
- if ( num_1 > num_2 ) {
20
- max_num = num_1
18
+ // Check to see whether num1 or num2 is larger.
19
+ if ( num1 > num2 ) {
20
+ max_num = num1
21
21
} else {
22
- max_num = num_2
22
+ max_num = num2
23
23
}
24
24
lcm = max_num
25
25
26
26
while ( true ) {
27
- if ( ( lcm % num_1 === 0 ) && ( lcm % num_2 === 0 ) ) {
27
+ if ( ( lcm % num1 === 0 ) && ( lcm % num2 === 0 ) ) {
28
28
break
29
29
}
30
30
lcm += max_num
31
31
}
32
32
return lcm
33
33
}
34
34
35
- // Run `find_lcm ` Function
36
- var num_1 = 12
37
- var num_2 = 76
38
- console . log ( find_lcm ( num_1 , num_2 ) )
35
+ // Run `findLcm ` Function
36
+ var num1 = 12
37
+ var num2 = 76
38
+ console . log ( findLcm ( num1 , num2 ) )
You can’t perform that action at this time.
0 commit comments