# Compucolor.org – Virtual Media

```100 PLOT  12
105 REM  ***
110 REM  *** THIS PROGRAM FINDS REAL AND IMAGINARY ROOTS
120 REM  *** FOR THE EQUATION AX^2 + BX + C = 0
130 REM  *** USING THE QUADRATIC EQUATION TO SOLVE FOR X
140 REM  ***
150 PRINT "THIS PROGRAM FINDS THE ROOTS OF THE EQUATION";
160 PRINT " AX^2 + BX + C = 0 ":PRINT
170 INPUT  "INPUT A  ";A:PRINT
180 INPUT  "INPUT B  ";B:PRINT
190 INPUT  "INPUT C  ";C:PRINT
200 REM  ***
210 REM  *** D DETERMINS IF THE ROOTS ARE REAL OR IMAGINARY
220 REM  *** IF D IS POSIVE THE ROOTS ARE REAL
230 REM  *** IF D IS NEGATIVE THE ROOTS ARE IMAGINARY
240 REM  ***
250 D= B^ 2- 4* A* C
260 REM  ***
270 REM  *** 140 DECIDES IF THERE IS ONE OR TWO SOLUTIONS
280 REM  *** IF A = 0 THEN THERE IS ONE SOLUTION
290 REM  *** IF A DOESN'T EQUAL 0  THERE ARE TWO SOLUTIONS
300 REM  ***
310 IF A< > 0THEN 370
320 REM  *** 150 FINDS  OUT IF THE EQUATION IS SOLVABLE
330 IF  B =   0 AND  A=  0 THEN 550
340 REM  *** SOLVES FOR X ONE SOLUTION
350 PRINT :PRINT "ONLY ONE SOLUTION ":PRINT :PRINT "X = ";- C/ B
360 GOTO 560
370 IF  D <  0 THEN 510
380 REM  ***
390 REM  *** SOLVES FOR X USING THE QUADRATIC EQUATION
400 REM  *** THE ROOTS ARE REAL
410 REM  ***
420 PRINT :PRINT "TWO SOLUTIONS ":PRINT :PRINT "X = (";
430 PRINT (- B+ SQR (D))/ (2* A);") AND (";
440 PRINT (- B- SQR (D))/ (2* A);")"
450 GOTO 560
460 REM  ***
470 REM  *** SOLVES FOR IMAGINARY X AS D IS NEGATIVE
480 REM  *** AND A SQUARE ROOT OF A NEGATIVE NUMBER
490 REM  *** IS NOT A REAL NUMBER
500 REM  ***
510 PRINT :PRINT  "TWO IMAGINARY SOLUTIONS  ":PRINT
520 PRINT  "X =  ("SQR (- D)/ (2* A);") AND (";
530 PRINT  - SQR (- D)/ (2* A)")"
540 GOTO 560
550 PRINT  "EQUATION IS' UNDEFINED'" C"  = 0"
560 PRINT :PRINT "HIT 'C'ONTINUE OR 'M'ENU AND THEN 'ENTER'  "
570 INPUT  Z\$:IF  Z\$= "C" THEN  100
580 IF  Z\$= "M" THEN  600
590 PRINT :PRINT  "INVALID INPUT  ":GOTO 560
600 PRINT  "END OF PROGRAM.   SEE YA LATER.  LOADING MENU.":FOR  I= 0TO 250:NEXT  I:PLOT  1
```