Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e9b6c0f

Browse files
added program to find HCF or GCD👩‍💻
1 parent 2c6085d commit e9b6c0f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /