def truncate(num, n):
integer = int(num * (10**n))/(10**n)
return float(integer)
while True:
try:
a = 0
b = 0
n = 0
ans = 0
str1 = ''
a,b,n = (map(int,input().split()))
str1 = ("0.{0}f".format(n))
ans = ("{:"+str1+"}").format(truncate(a/b,n))
print(ans)
except:
break
測試的時候你可以把 N 改大一點(n > 12)
然後同時輸出truncate()
和 ans