python greatest common divisor of two numbers

Given two integers a, b, find their greatest common divisor

DEF GCD (A, B): 
    IF A <B: 
        A, B = B, A 
    the while (A% B = 0!): 
        C = A% B 
        A = B 
        B = C 
    return B 

A, B = Map (int , input ( "enter two integers:") split ()) # a two input variables manner. 
RES = GCD (a, B) 
Print (RES)

  

GCD DEF (A, B): 
    IF A% B == 0: 
        return B 
    the else: 
        GCD (B, A% B) 

A, B = Map (int, INPUT ( "enter two integers:".) split ( )) 
C = GCD (A, B) 
Print (C)

  

Guess you like

Origin www.cnblogs.com/jiaxinwei/p/11610652.html