# -*- coding: utf-8 -*-
# 递归
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
print(gcd(12, 16))
# 非递归
def gcd2(a, b):
while b > 0:
r = a % b
a = b
b = r
return a
print(gcd2(12, 16))
标签:12,gcd2,gcd,16,--,最大公约数,print,return,除法
From: https://www.cnblogs.com/zylyehuo/p/17643084.html