You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defloop_of_hcf(x, y): # highest common divisior that pefectly divides both numbers
# hcf can only be equal to or less than smaller number for that we have consider the smaller number.
ifx>y:
smaller=y
else:
smaller=x
foriinrange(1, smaller+1):
if (x%i)==0and (y%i) ==0:
hcf=i
returnhcf
# This method of loop is not that efficient for hcf
defeucladian_hcf(xx,yy):
while(yy):
xx, yy=yy, xx%yy# in this algorithm we divide the greater number by smaller number and takes the remainder then we divide the smaller number by reaminder ...this is repeated until we get 0