Advertisement
Guest User

Computercraft Calculator

a guest
Jun 3rd, 2017
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. print("Welcome to the calculator!")
  2.  
  3. repeat
  4.  
  5. print ("Please choose one of the four option: for addition type '+', for abstraction type '-', for multiplication type '*' and for division type '/'.")
  6. calc_q = read()
  7. print("Put your first number here: ")
  8. number1 = read()
  9. print("Put your second number here: ")
  10. number2 = read()
  11.  
  12. if calc_q == "+" then
  13. etaresult = number1+number2
  14. print("The result is: ")
  15. print(result)
  16.  
  17. elseif calc_q == "-" then
  18. result = number1-number2
  19. print("The result is: ")
  20. print(result)
  21.  
  22. elseif calc_q == "*" then
  23. result = number1*number2
  24. print("The result is: ")
  25. print(result)
  26.  
  27. elseif calc_q == "/" then
  28. result = number1/number2
  29. print("The result is: ")
  30. print(result)
  31.  
  32. else print("You put the wrong operation!")
  33. end
  34.  
  35. print("If you want to use the calculator again, press enter. If you want to exit the program, type 'exit'")
  36. continue_q = read()
  37.  
  38. until (continue_q == "exit")
  39.  
  40. print("Thank you for usining Pop's calculator!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement