Skip to content

Commit 8b7c07f

Browse files
authored
lcm
1 parent e8b1ad6 commit 8b7c07f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lcm.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Python Program to find the L.C.M. of two input number
2+
3+
def compute_lcm(x, y):
4+
5+
# choose the greater number
6+
if x > y:
7+
greater = x
8+
else:
9+
greater = y
10+
11+
while(True):
12+
if((greater % x == 0) and (greater % y == 0)):
13+
lcm = greater
14+
break
15+
greater += 1
16+
17+
return lcm
18+
19+
num1 = 54
20+
num2 = 24
21+
22+
print("The L.C.M. is", compute_lcm(num1, num2))

0 commit comments

Comments
 (0)