Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

How do I implement the greatest common divisor algorithm in python? I need to write a piece of code but I don't know how..

OpenStudy (anonymous):

do you know the euclidean algorithm?

OpenStudy (anonymous):

def Gcd(): x = input("Enter the greater number : ") y = input("Enter the smaller number : ") while y != 0: remainder = x % y x = y y=remainder print "Gcd is : ",x

OpenStudy (anonymous):

Best is to write out how to find the greatest common divisor, than turn your steps into pusedocode(however you spell it), from there im sure youll get it working.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!