1 3REM T R I A N G
  2 4REM
  3 6 PRINT "TRIANG"
  4 10 DIM A(10),B(10),C(10),H(10),R(10),S(10)
  5 100 PRINT
  6 105 DEF FNS(I)= .01*INT(6000*(B(I)-INT(B(I)))+.5)
  7 110 PRINT "THIS PROGRAM WILL FIND THE UNKNOWN FEATURES OF ANY"
  8 115 PRINT "TRIANGLE, GIVEN ONE SIDE AND ANY TWO OTHER PARTS."
  9 120 PRINT
 10 125 PRINT
 11 130 PRINT "WHAT WILL BE GIVEN (1=SSS, 2=SAS, 3=SSA, 4=ASA, 5=AAS)";
 12 135 INPUT N
 13 140 PRINT
 14 145 LET R8=0
 15 150 LET R9=0
 16 155 IF (N-1)*(N-2)*(N-3)*(N-4)*(N-5)=0 THEN 170
 17 160 PRINT "ANSWER 1, 2, 3, 4, OR 5 PLEASE...."
 18 165 GOTO 125
 19 170 IF N=1 THEN 210
 20 175 PRINT "NOTE: SPECIFY ANGLES AS 'DEGREES, MINUTES, SECONDS'  OR"
 21 180 PRINT "      'DEGREES, MINUTES.DECIMAL, 0' (I.E., SECONDS=0)"
 22 185 PRINT
 23 190 IF N=2 THEN 230
 24 195 IF N=4 THEN 270
 25 200 IF N=5 THEN 335
 26 205 IF N=3 THEN 385
 27 210 PRINT "WHAT ARE SIDE1, SIDE2, SIDE3";
 28 215 INPUT S(1),S(2),S(3)
 29 220 GOSUB 540
 30 225 GOTO 630
 31 230 PRINT "WHAT ARE SIDE1, ANGLE3, SIDE2";
 32 235 INPUT S(1),A(3),B(3),C(3),S(2)
 33 240 GOSUB 830
 34 245 LET I=3
 35 250 GOSUB 620
 36 255 LET S(3)=SQR(S(1)^2+S(2)^2-2*S(1)*S(2)*COS(R(3)))
 37 260 GOSUB 540
 38 265 GOTO 630
 39 270 PRINT "WHAT ARE ANGLE1, SIDE3, ANGLE2";
 40 275 INPUT A(1),B(1),C(1),S(3),A(2),B(2),C(2)
 41 280 GOSUB 830
 42 285 FOR I=1 TO 2
 43 290 GOSUB 620
 44 295 NEXT I
 45 300 LET R(3)=3.14159265-R(1)-R(2)
 46 305 LET I=3
 47 310 GOSUB 575
 48 315 FOR I=1 TO 2
 49 320 GOSUB 530
 50 325 NEXT I
 51 330 GOTO 630
 52 335 PRINT "WHAT ARE ANGLE3, ANGLE1, SIDE3";
 53 340 INPUT A(3),B(3),C(3),A(1),B(1),C(1),S(3)
 54 345 GOSUB 830
 55 350 FOR I=1 TO 3 STEP 2
 56 355 GOSUB 620
 57 360 NEXT I
 58 365 LET R(2)=3.14159265-R(1)-R(3)
 59 370 LET I=2
 60 375 GOSUB 575
 61 380 GOTO 315
 62 385 PRINT "WHAT ARE SIDE1, SIDE3, ANGLE1";
 63 390 INPUT S(1),S(3),A(1),B(1),C(1)
 64 395 GOSUB 830
 65 400 LET R8=1
 66 405 LET I=1
 67 410 GOSUB 620
 68 415 LET T=(S(3)*SIN(R(1)))/S(1)
 69 420 IF T-1>0.0000001 THEN 515
 70 425 IF 1-T>0.00000001 THEN 440
 71 430 LET R(3)=1.57079632
 72 435 GOTO 445
 73 440 LET R(3)=ATN(T/SQR(1-T^2))
 74 445 LET R(2)=3.14159265-R(1)-R(3)
 75 450 LET I=2
 76 455 GOSUB 530
 77 460 FOR I=2 TO 3
 78 465 GOSUB 575
 79 470 NEXT I
 80 475 IF R9=1 THEN 510
 81 480 IF S(3)>S(1) THEN 490
 82 485 GO TO 505
 83 490 PRINT
 84 495 PRINT "ONE SOLUTION IS:"
 85 500 GO TO 510
 86 505 LET R8 = 0
 87 510 GOTO 630
 88 515 PRINT
 89 520 PRINT "NO SOLUTION POSSIBLE...."
 90 525 GOTO 800
 91 530 LET S(I)=(S(3)/SIN(R(3)))*SIN(R(I))
 92 535 RETURN
 93 540 LET P=(S(1)+S(2)+S(3))/2
 94 545 LET R=SQR(((P-S(1))*(P-S(2))*(P-S(3)))/P)
 95 550 FOR I=1 TO 3
 96 555 LET R(I)=2*ATN(R/(P-S(I)))
 97 560 GOSUB 575
 98 565 NEXT I
 99 570 RETURN
100 575 LET X1=57.2957795*R(I)
101 580 LET A(I)=INT(X1)
102 585 LET B(I)=60*(X1-A(I))
103 590 IF ABS(60-B(I))>0.00005 THEN 605
104 595 LET B(I)=0
105 600 LET A(I)=A(I)+1
106 605 IF ABS(B(I))>0.0001 THEN 615
107 610 LET B(I)=0
108 615 RETURN
109 620 LET R(I)=(A(I)+B(I)/60)/57.2957795
110 625 RETURN
111 630 GOSUB 540
112 635 LET W=R*P
113 640 LET R1=S(1)/(2*SIN(R(1)))
114 645 LET H(1)=S(3)*SIN(R(2))
115 650 LET H(2)=S(1)*SIN(R(3))
116 655 LET H(3)=S(2)*SIN(R(1))
117 660 PRINT
118 665 IF R9=1 THEN 685
119 670 PRINT
120 675 PRINT " ","        1","        2","        3"
121 680 PRINT " ","     -------","     -------","     -------"
122 685 PRINT
123 690 PRINT "SIDE",S(1),S(2),S(3)
124 695 PRINT
125 700 PRINT "ANGLE (RAD)",R(1),R(2),R(3)
126 705 PRINT
127 710 PRINT "ANGLE (DEG)",A(1),A(2),A(3)
128 715 PRINT "      (MIN)", INT(B(1)),INT(B(2)),INT(B(3))
129 720 PRINT "      (SEC)", FNS(1), FNS(2), FNS(3)
130 725 PRINT
131 730 PRINT "ALT TO SIDE",H(1),H(2),H(3)
132 735 PRINT
133 740 PRINT
134 745 PRINT "RADIUS OF CIRCUMSCR CIRCLE = ";R1
135 750 PRINT "RADIUS OF INSCRIBED CIRCLE = ";R
136 755 PRINT "          AREA OF TRIANGLE = ";W
137 760 PRINT
138 765 IF R9=1 THEN 800
139 770 IF R8=0 THEN 800
140 775 PRINT
141 780 PRINT "A SECOND SOLUTION IS:"
142 785 LET R9=1
143 790 LET R(3)=3.14159265-R(3)
144 795 GOTO 445
145 800 PRINT
146 805 PRINT
147 810 PRINT "ANOTHER CASE (1=YES)";
148 815 INPUT Q
149 820 IF Q=1 THEN 120
150 825 STOP
151 830 FOR I=1 TO 3
152 835 LET B(I)= B(I) + C(I)/60
153 840 NEXT I
154 845 RETURN
155 9999 END