Header Ads Widget

Responsive Advertisement

LCM & HCF of Two Number

 


a = int (input("Enter 1st Number : "))
b = int (input("Enter 2nd Number : "))

if(a>b):
    min = b
else:
    min=a

for i in range (1,min+1):
    if(a%i==0 and b%i==0):
        hcf = i
print (f"The HCF of {a} and {b} is : {hcf}")
lcm = (a*b)//hcf
print (f"The Lcm {a} and {b} is : {lcm}")


Post a Comment

0 Comments