python program
Write a program in python to find H C F of two number.
A program to find H C F of two number.
As we know that The Highest Common Factor(HCF) of two or more numbers is the greatest number which divides each of them exactly. so for calculating HCF we need to calculate that highest no. which divide each number.
code:
x=int(input("Enter first number : "))
y=int(input("Enter another number : "))
small=x
if x>y:
small=y
else:
small=x
while 1:
if x%small==0 and y%small==0:
print("H C F Of ",x,"and",y,"is ",small)
break
else:
small-=1
No comments:
Post a Comment