Python的math库:最大公约数gcd

gcd,即Greatest Common Divisor的缩写,意为最大公约数

示例

import math
num = math.gcd(12,8)
print(num)

控制台输出

4

进程已结束,退出代码0
posted @ 2022-05-16 11:50  孤舟浮岸  阅读(569)  评论(0)    收藏  举报