Advertisement
devomaa

thing

May 11th, 2020
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. num = nil
  3. input = nil
  4. print("min random?")
  5. startRand = io.read()
  6. print("max random?")
  7. randomizer = io.read()
  8. print("min additions?")
  9. minAdd = io.read()
  10. print("max additions?")
  11. maxAdd = io.read()
  12. while true do
  13. total = 0
  14. additions = math.random(minAdd,maxAdd)
  15. message = "What is "
  16. for i=1,additions do
  17. num = math.random(startRand,randomizer)
  18. total = total + num
  19. message = message .. num
  20. if (i < additions) then
  21. message = message .. " + "
  22. end
  23. end
  24. print (message)
  25. input = io.read()
  26. if tonumber(input) == total then
  27. print("you got it right !")
  28. else
  29. print("you might have got it wrong, or its a bug")
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement