python17课 求最大公约数
temp1=input('请输入第一个数:')temp2=input('请输入第二个数:')
x1=max(temp1,temp2)
x2=min(temp1,temp2)
while True:
if x1%x2==0:
gys=x2
break
else:
ys=x1%x2
x2=ys
x1=x2 #碾转法
print(gys)
错误是:Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\python\16.1.py", line 9, in <module> if x1%x2==0:
TypeError: not all arguments converted during string formatting
这是什么错误
数字先从字符型转成整型。
temp1=int(input('请输入第一个数:'))
temp2=int(input('请输入第二个数:'))
页:
[1]