RetroCoders Community

Other Languages Programming => Lua => Topic started by: ron77_db on Apr 01, 2022, 11:05 AM

Title: [Lua] Simple Multiple Program
Post by: ron77_db on Apr 01, 2022, 11:05 AM
hello here is a small program to help someone learn multiplying numbers

repeat
math.randomseed(os.time())
num1 , num2 = math.random(1, 10), math.random(1, 10)

true_num = num1 * num2

io.write(num1 .. " x " .. num2 .. " = anter your answer: ")
ans = io.read()
if tonumber(ans) == true_num then
  print("your answer was correct!! well done!")
else
  print("your answer was incorrect!")
end


until ans == "quit"