#File: ChapterRecursion/gcd.py """ gcd(n,m) = greatest common divder of two integers EUCLID's algorithm first int? 60 second int? 54 computing gcd(60, 54) computing gcd(54, 6) computing gcd(6, 0) gcd( 60, 54 ) = 6 """ def gcd( a, b ): print( "computing gcd(%d, %d)" % (a, b)) if b == 0 : return a else: return gcd( b, a % b ) def main(): while True: a = int(input( "first int? " )) b = int(input( "second int? " )) if ( a == 0 or b == 0): break; print("gcd( %d, %d ) = %d" % (a, b, gcd( a,b ) )) main()