Advertisement
Prithak

Qbasic Calculator

May 6th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 1.63 KB | None | 0 0
  1. 'QBASIC calculator! Made by Prithak Adhikari
  2. DIM a AS INTEGER
  3. DIM b AS INTEGER
  4. top:
  5. CLS
  6. PRINT "Welcome to Prithak's Calculator"
  7. PRINT
  8. INPUT "Enter the first number"; a
  9. INPUT "Enter the Mathmatical Operator(+,-,*,/,^,MOD)"; oper$
  10. SELECT CASE oper$
  11.     CASE "+"
  12.         INPUT "Enter second number"; b
  13.         sum = a + b
  14.         PRINT "Result: "; sum
  15.         INPUT "Would you like to do it again(y/n)"; ch$
  16.         IF ch$ = "y" THEN GOTO top
  17.         IF ch$ = "n" THEN END
  18.     CASE "-"
  19.         INPUT "Enter second number"; b
  20.         diff = a - b
  21.         PRINT "Result: "; diff
  22.         INPUT "Would you like to do this again(y/n)"; ch$
  23.         IF ch$ = "y" THEN GOTO top
  24.         IF ch$ = "n" THEN END
  25.     CASE "*"
  26.         INPUT "Enter second number"; b
  27.         mult = a * b
  28.         PRINT "Result: "; mult
  29.         INPUT "Would you like to d othis again(y/n)"; ch$
  30.         IF ch$ = "y" THEN GOTO top
  31.         IF ch$ = "n" THEN END
  32.  
  33.     CASE "/"
  34.         INPUT "Enter second number"; b
  35.         div = a / b
  36.         PRINT "Result: "; div
  37.         INPUT "Would you like to d othis again(y/n)"; ch$
  38.         IF ch$ = "y" THEN GOTO top
  39.         IF ch$ = "n" THEN END
  40.     CASE "^"
  41.         INPUT "Enter second number"; b
  42.         expo = a ^ b
  43.         PRINT "Result: "; expo
  44.         INPUT "Would you like to d othis again(y/n)"; ch$
  45.         IF ch$ = "y" THEN GOTO top
  46.         IF ch$ = "n" THEN END
  47.     CASE "MOD"
  48.         INPUT "Enter second number"; b
  49.         modd = a MOD b
  50.         PRINT "Result: "; modd
  51.         INPUT "Would you like to d othis again(y/n)"; ch$
  52.         IF ch$ = "y" THEN GOTO top
  53.         IF ch$ = "n" THEN END
  54. END SELECT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement