calculator.bas (1782B)
1 #lang "qb" 2 10 PRINT "Welcome to the BASIC Calculator." 3 20 PRINT "Please enter the number corresponding to the option you want to perform on the calculator." 4 30 PRINT "0: Exit" 5 40 PRINT "1: Add" 6 50 PRINT "2: Subtract" 7 60 PRINT "3: Multiply" 8 70 PRINT "4: Divide" 9 80 PRINT "5: Absolute Value" 10 90 PRINT "6: Arctangent" 11 100 PRINT "7: Cosine" 12 110 PRINT "8: Exponential" 13 120 PRINT "9: Floor of a Number" 14 130 PRINT "10: Natural Logarithm" 15 140 PRINT "11: Random Number" 16 150 PRINT "12: Sine" 17 160 PRINT "13: Square Root" 18 170 PRINT "14: Tangent" 19 180 INPUT O 20 190 IF O = 0 THEN 850 21 200 IF O = 1 THEN 350 22 210 IF O = 2 THEN 350 23 220 IF O = 3 THEN 350 24 230 IF O = 4 THEN 350 25 240 IF O = 5 THEN 520 26 250 IF O = 6 THEN 520 27 260 IF O = 7 THEN 520 28 270 IF O = 8 THEN 520 29 280 IF O = 9 THEN 520 30 290 IF O = 10 THEN 520 31 300 IF O = 11 THEN 520 32 310 IF O = 12 THEN 520 33 320 IF O = 13 THEN 520 34 330 IF O = 14 THEN 520 35 340 36 350 PRINT "Please enter a number:" 37 360 INPUT A 38 370 PRINT "Please enter another number:" 39 380 INPUT B 40 390 IF O = 1 THEN 430 41 400 IF O = 2 THEN 450 42 410 IF O = 3 THEN 470 43 420 IF O = 4 THEN 490 44 430 PRINT A + B 45 440 GOTO 850 46 450 PRINT A - B 47 460 GOTO 850 48 470 PRINT A * B 49 480 GOTO 850 50 490 PRINT A / B 51 500 GOTO 850 52 510 53 520 PRINT "Please enter a number:" 54 530 INPUT A 55 540 IF O = 5 THEN 640 56 550 IF O = 6 THEN 660 57 560 IF O = 7 THEN 680 58 570 IF O = 8 THEN 700 59 580 IF O = 9 THEN 720 60 590 IF O = 10 THEN 740 61 600 IF O = 11 THEN 760 62 610 IF O = 12 THEN 780 63 620 IF O = 13 THEN 800 64 630 IF O = 14 THEN 820 65 640 PRINT Abs(A) 66 650 GOTO 850 67 660 PRINT Atn(A) 68 670 GOTO 850 69 680 PRINT Cos(A) 70 690 GOTO 850 71 700 PRINT Exp(A) 72 710 GOTO 850 73 720 PRINT Int(A) 74 730 GOTO 850 75 740 PRINT Log(A) 76 750 GOTO 850 77 760 PRINT Rnd(A) 78 770 GOTO 850 79 780 PRINT Sin(A) 80 790 GOTO 850 81 800 PRINT Sqr(A) 82 810 GOTO 850 83 820 PRINT Tan(A) 84 830 GOTO 850 85 840 86 850 END 87