Skip to content

Commit a60a6a7

Browse files
Create Code To Find LCM
1 parent b8449a7 commit a60a6a7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Code To Find LCM

+22
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)