mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Delete Maths/find_hcf.py (#636)
This commit is contained in:
parent
dd9f0b3f2e
commit
e6eb6dbb82
@ -1,22 +0,0 @@
|
|||||||
# Program to find the HCF of two Numbers
|
|
||||||
def find_hcf(num_1, num_2):
|
|
||||||
if num_1 == 0:
|
|
||||||
return num_2
|
|
||||||
if num_2 == 0:
|
|
||||||
return num_1
|
|
||||||
# Base Case
|
|
||||||
if num_1 == num_2:
|
|
||||||
return num_1
|
|
||||||
if num_1 > num_2:
|
|
||||||
return find_hcf(num_1 - num_2, num_2)
|
|
||||||
return find_hcf(num_1, num_2 - num_1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
num_1 = 24
|
|
||||||
num_2 = 34
|
|
||||||
print('HCF of %s and %s is %s:' % (num_1, num_2, find_hcf(num_1, num_2)))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
Loading…
Reference in New Issue
Block a user