why is there a position exchange?
Why is there an exchange of "(x, y) = (y, x) if x > y"? If there wasn't such an exchange, does it affect the calculation result if x > y ? Thank you for your time!pull/221/head
parent
cc537bd125
commit
e36e5dd071
|
@ -8,8 +8,6 @@ Date: 2018-03-01
|
||||||
|
|
||||||
x = int(input('x = '))
|
x = int(input('x = '))
|
||||||
y = int(input('y = '))
|
y = int(input('y = '))
|
||||||
if x > y:
|
|
||||||
(x, y) = (y, x)
|
|
||||||
for factor in range(x, 0, -1):
|
for factor in range(x, 0, -1):
|
||||||
if x % factor == 0 and y % factor == 0:
|
if x % factor == 0 and y % factor == 0:
|
||||||
print('%d和%d的最大公约数是%d' % (x, y, factor))
|
print('%d和%d的最大公约数是%d' % (x, y, factor))
|
||||||
|
|
Loading…
Reference in New Issue