HCF is also called Greatest Common divisor (GCD).
the HCF of two or more number is the largest of all the common factors.
for example:
if we take two numbers, 12 and 18
their common divisor are 1,2,3 and 6. therefore 6 being the biggest is the HCF of 12 and 18.
Here, we are using loop method to find HCF of two numbers. It can also be calculated using recursion.
x,y = input("Enter two integer").split()
x,y = [int(x), int(y)] #convert input string to integers
a = x
b = y
while(b != 0 ):
t = b
b = a % b
a = t
hcf = a
lcm = (x*y)/hcf
print("HCF of %d and %d is %dn" %(x,y,hcf))
print("LCM of %d and %d is %dn" %(x,y,lcm))
for python2, replace input function with raw_input