SHARE
TWEET

Untitled

a guest Oct 21st, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' {$STAMP BS2}
  2. ' {$PBASIC 2.5}
  3.  
  4.  
  5. START:
  6.  
  7. NUM1 var word
  8. NUM2 var word
  9. NUM3 var word
  10. userchoice var byte
  11.  
  12. BEGIN:
  13.  
  14. DEBUG CR, CR, "Enter the first number "
  15. DEBUGIN dec3 NUM1
  16.  
  17. DEBUG "Enter the second number "
  18. DEBUGIN dec3 NUM2
  19.  
  20. DEBUG "Please choose a math function (a,s,d,m) "
  21. DEBUGIN userchoice
  22. if userchoice = "a" then GOTO addition
  23. if userchoice = "s" then GOTO subtraction
  24. if userchoice = "m" then GOTO multiplication
  25. if userchoice = "d" then GOTO division
  26. DEBUG "ERROR"
  27. GOTO START
  28.  
  29. addition:
  30. NUM3 = NUM1 + NUM2
  31. DEBUG CR, "The answer to ", dec NUM1, " + ", dec NUM2, " = ", dec NUM3
  32. PAUSE 3000
  33. GOTO START
  34.  
  35. subtraction:
  36. NUM3 = NUM1 - NUM2
  37. DEBUG CR, "The answer to ", dec NUM1, " - ", dec NUM2, " = ", dec NUM3
  38. PAUSE 3000
  39. GOTO START
  40.  
  41. multiplication:
  42. NUM3 = NUM1 * NUM2
  43. DEBUG CR, "The answer to ", dec NUM1, " * ", dec NUM2, " = ", dec NUM3
  44. PAUSE 3000
  45. GOTO START
  46.  
  47. division:
  48. NUM3 = NUM1 / NUM2
  49. DEBUG CR, "The answer to ", dec NUM1, " / ", dec NUM2, " = ", dec NUM3
  50. PAUSE 3000
  51. GOTO START
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top