Skip to content

Commit c323a8a

Browse files
Create Hcflcmfinder.py
1 parent 45d8341 commit c323a8a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Hcflcmfinder.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Python program to find H.C.F of two numbers
2+
3+
# define a function
4+
def compute_hcf(x, y):
5+
6+
# choose the smaller number
7+
if x > y:
8+
smaller = y
9+
else:
10+
smaller = x
11+
for i in range(1, smaller+1):
12+
if((x % i == 0) and (y % i == 0)):
13+
hcf = i
14+
return hcf
15+
16+
num1 = 54
17+
num2 = 24
18+
19+
print("The H.C.F. is", compute_hcf(num1, num2))

0 commit comments

Comments
 (0)