1 Star 0 Fork 0

fanyangchu/PythonCode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gcd.py 363 Bytes
一键复制 编辑 原始数据 按行查看 历史
Lalit-Kumar20 提交于 2019-10-18 00:00 . code for gcd
'''
although there is function to find gcd in python but this is the code which
takes two inputs and prints gcd of the two.
'''
a = int(input("Enter number 1 (a): "))
b = int(input("Enter number 2 (b): "))
i = 1
while(i <= a and i <= b):
if(a % i == 0 and b % i == 0):
gcd = i
i = i + 1
print("\nGCD of {0} and {1} = {2}".format(a, b, gcd))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fanych/pythoncode.git
git@gitee.com:fanych/pythoncode.git
fanych
pythoncode
PythonCode
master

搜索帮助