daily pastebin goal
76%
SHARE
TWEET

calc

mattiabergamelli Sep 14th, 2018 67 in 302 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("Do you want to add, subtract, multiply or divide?")
  2. op = read()
  3. print("")
  4. print("what is the first number to be operated on?")
  5. num1 = tonumber(read())
  6. print("")
  7. print("and the second number?")
  8. num2 = tonumber(read())
  9. print("")
  10. if op == "add" then
  11. result = num1+num2
  12. print(result)
  13. end
  14. if op == "multiply" then
  15. result = num1*num2
  16. print(result)
  17. end
  18. if op == "divide" then
  19. result = num1/num2
  20. print(result)
  21. end
  22. if op == "subtract" then
  23. result = num1-num2
  24. print(result)
  25. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top