We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f438440 commit 9f8953dCopy full SHA for 9f8953d
maths/find_lcm.py
@@ -4,8 +4,17 @@
4
5
6
def find_lcm(num_1, num_2):
7
- """Find the LCM of two numbers."""
8
- max_num = num_1 if num_1 > num_2 else num_2
+ """Find the least common multiple of two numbers.
+ >>> find_lcm(5,2)
9
+ 10
10
+ >>> find_lcm(12,76)
11
+ 228
12
+ """
13
+ if num_1>=num_2:
14
+ max_num=num_1
15
+ else:
16
+ max_num=num_2
17
+
18
lcm = max_num
19
while True:
20
if ((lcm % num_1 == 0) and (lcm % num_2 == 0)):
@@ -16,8 +25,8 @@ def find_lcm(num_1, num_2):
25
26
def main():
27
"""Use test numbers to run the find_lcm algorithm."""
- num_1 = 12
- num_2 = 76
28
+ num_1 = int(input().strip())
29
+ num_2 = int(input().strip())
21
30
print(find_lcm(num_1, num_2))
22
31
23
32
0 commit comments