News:

Welcome to RetroCoders Community

Main Menu

[Lua] Simple Multiple Program

Started by ron77_db, Apr 01, 2022, 11:05 AM

Previous topic - Next topic

ron77_db

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"