create account

Python Program to Find HCF or GCD by python-dev

View this thread on: hive.blogpeakd.comecency.com
· @python-dev ·
$0.47
Python Program to Find HCF or GCD
``` 
# Python program to find H.C.F of two numbers

# define a function
def compute_hcf(x, y):

# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf

num1 = 54 
num2 = 24

print("The H.C.F. is", compute_hcf(num1, num2))
 ```
👍  ,
properties (23)
authorpython-dev
permlinkpython-program-to-find-hcf-or-gcd
categorypython-dev
json_metadata{"tags":["python-dev"],"app":"hiveblog/0.1","format":"markdown"}
created2020-03-22 10:43:21
last_update2020-03-22 10:43:21
depth0
children0
last_payout2020-03-29 10:43:21
cashout_time1969-12-31 23:59:59
total_payout_value0.232 HBD
curator_payout_value0.233 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length376
author_reputation5,457,648,648,750
root_title"Python Program to Find HCF or GCD"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,537,617
net_rshares1,484,636,251,498
author_curate_reward""
vote details (2)