Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' {$STAMP BS2}
- ' {$PBASIC 2.5}
- START:
- NUM1 var word
- NUM2 var word
- NUM3 var word
- userchoice var byte
- BEGIN:
- DEBUG CR, CR, "Enter the first number "
- DEBUGIN dec3 NUM1
- DEBUG "Enter the second number "
- DEBUGIN dec3 NUM2
- DEBUG "Please choose a math function (a,s,d,m) "
- DEBUGIN userchoice
- if userchoice = "a" then GOTO addition
- if userchoice = "s" then GOTO subtraction
- if userchoice = "m" then GOTO multiplication
- if userchoice = "d" then GOTO division
- DEBUG "ERROR"
- GOTO START
- addition:
- NUM3 = NUM1 + NUM2
- DEBUG CR, "The answer to ", dec NUM1, " + ", dec NUM2, " = ", dec NUM3
- PAUSE 3000
- GOTO START
- subtraction:
- NUM3 = NUM1 - NUM2
- DEBUG CR, "The answer to ", dec NUM1, " - ", dec NUM2, " = ", dec NUM3
- PAUSE 3000
- GOTO START
- multiplication:
- NUM3 = NUM1 * NUM2
- DEBUG CR, "The answer to ", dec NUM1, " * ", dec NUM2, " = ", dec NUM3
- PAUSE 3000
- GOTO START
- division:
- NUM3 = NUM1 / NUM2
- DEBUG CR, "The answer to ", dec NUM1, " / ", dec NUM2, " = ", dec NUM3
- PAUSE 3000
- GOTO START
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement