17.Write a Python program to find LCM and HCF of 2 numbers.

Solution  :- 

# HCF
a = int(input(“Enter the First number :- “))
b = int(input(“Enter the Second number :- “))

hcf = 1
for i in range(2,a+1):
if a%i==0 and b%i==0:
hcf = i
print(“First number is :- “,a)
print(“Second number is :- “,b)
print(“HCF of the number is “,hcf)

# LCM

c = int(input(“Enter the First number :- “))
d = int(input(“Enter the Second number :- “))
hcf = 1
for i in range(2,a+1):
if(a%i==0 and b%i==0):
hcf=i
print(“First Number is :- “,a)
print(“Second number is:-” ,b)
lcm = int((a*b)/(hcf))
print(“Lcm of the two number is :- “,lcm)

Output :-