GCD Calculation Function

  • Share this:

Code introduction


This function accepts two integers as arguments and returns their greatest common divisor.


Technology Stack : Python built-in

Code Type : Function

Code Difficulty : Beginner


                
                    
def aaaaaaa(arg1, arg2):
    """
    计算两个数的最大公约数(GCD)。
    """
    while arg2:
        arg1, arg2 = arg2, arg1 % arg2
    return arg1