commit 5849b32ba608b3f782cb437ae04e5c0318f523fb Author: Evan Alba <evanalba@protonmail.com> Date: Mon, 28 Nov 2022 18:47:33 -0800 feat: Added Basic directory. Diffstat:
A | basic/calculator.bas | | | 87 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 87 insertions(+), 0 deletions(-)
diff --git a/basic/calculator.bas b/basic/calculator.bas @@ -0,0 +1,87 @@ +#lang "qb" +10 PRINT "Welcome to the BASIC Calculator." +20 PRINT "Please enter the number corresponding to the option you want to perform on the calculator." +30 PRINT "0: Exit" +40 PRINT "1: Add" +50 PRINT "2: Subtract" +60 PRINT "3: Multiply" +70 PRINT "4: Divide" +80 PRINT "5: Absolute Value" +90 PRINT "6: Arctangent" +100 PRINT "7: Cosine" +110 PRINT "8: Exponential" +120 PRINT "9: Floor of a Number" +130 PRINT "10: Natural Logarithm" +140 PRINT "11: Random Number" +150 PRINT "12: Sine" +160 PRINT "13: Square Root" +170 PRINT "14: Tangent" +180 INPUT O +190 IF O = 0 THEN 850 +200 IF O = 1 THEN 350 +210 IF O = 2 THEN 350 +220 IF O = 3 THEN 350 +230 IF O = 4 THEN 350 +240 IF O = 5 THEN 520 +250 IF O = 6 THEN 520 +260 IF O = 7 THEN 520 +270 IF O = 8 THEN 520 +280 IF O = 9 THEN 520 +290 IF O = 10 THEN 520 +300 IF O = 11 THEN 520 +310 IF O = 12 THEN 520 +320 IF O = 13 THEN 520 +330 IF O = 14 THEN 520 +340 +350 PRINT "Please enter a number:" +360 INPUT A +370 PRINT "Please enter another number:" +380 INPUT B +390 IF O = 1 THEN 430 +400 IF O = 2 THEN 450 +410 IF O = 3 THEN 470 +420 IF O = 4 THEN 490 +430 PRINT A + B +440 GOTO 850 +450 PRINT A - B +460 GOTO 850 +470 PRINT A * B +480 GOTO 850 +490 PRINT A / B +500 GOTO 850 +510 +520 PRINT "Please enter a number:" +530 INPUT A +540 IF O = 5 THEN 640 +550 IF O = 6 THEN 660 +560 IF O = 7 THEN 680 +570 IF O = 8 THEN 700 +580 IF O = 9 THEN 720 +590 IF O = 10 THEN 740 +600 IF O = 11 THEN 760 +610 IF O = 12 THEN 780 +620 IF O = 13 THEN 800 +630 IF O = 14 THEN 820 +640 PRINT Abs(A) +650 GOTO 850 +660 PRINT Atn(A) +670 GOTO 850 +680 PRINT Cos(A) +690 GOTO 850 +700 PRINT Exp(A) +710 GOTO 850 +720 PRINT Int(A) +730 GOTO 850 +740 PRINT Log(A) +750 GOTO 850 +760 PRINT Rnd(A) +770 GOTO 850 +780 PRINT Sin(A) +790 GOTO 850 +800 PRINT Sqr(A) +810 GOTO 850 +820 PRINT Tan(A) +830 GOTO 850 +840 +850 END +