我正在编写一个计算器,我试图打印除法方程的答案,但它却将分数转换为小数。我正在运行 Lua 5.2.4
print ("\n\tWhat math symbol will you use?")
ms = io.read()
-- Main function
function TYPCALC()
--If user typed certain math symbols
if (ms == "division") then
print ("\n\tWhat number will be divided to?")
local rn = io.read()
print ("\n\tWhat will be dividing?")
local ln = io.read()
--convert users answers in to strings
local cln = tonumber(ln)
local crn = tonumber(rn)
--do equasion
io.write (ln / rn)
end;
end ;
TYPCALC()