在这个程序中,当我输入3个数字13、179、0时,我从2个等效程序中得到2个不同的输出,第一个-202 26,第二个-202 27。为什么?
P = int(input())
X = int(input())
Y = int(input())
# first program outputs 202 26 (not correct)
summ = int((X * 100 + Y) * ((100 + P) / 100))
rub = summ // 100
kop = summ % 100
print(rub, kop)
# second program outputs 202 27 (correct)
money_before = 100 * X + Y
money_after = int(money_before * (100 + P) / 100)
print(money_after // 100, money_after % 100)
输入13、179和0,从第一个程序中获得202 26,从第二个程序中得到202 27。第二个是正确的。