60  IF  ERROR  THEN 1180
70  PRINT "This program will solve for any triangle given:"
80  PRINT "(1)AAS  (2)SSA  (3)SAS   (4)ASA  (5)SSS  (6)TO END"
90  PRINT "When entering angles, use the format DD,MM where DD is"
100  PRINT "the degree measure and MM is the minute angle. For example,"
110  PRINT "36 degrees and 2 minutes is entered:  36,02"
120  PRINT "47 degrees and 0 minutes is entered:  47,00"
125  PRINT "If there are no minutes then zero must be specified."
130  PRINT LIN(1);"Input number corresponing to your problem:";
140  INPUT N
160  LET K1=3.14159/180
170  LET K2=180/3.14159
180  GOTO N OF 230,400,740,890,950
190  CHAIN "*HELP"
200  END 
230  PRINT "Angle-Angle-Side";LIN(1);"Input angle 1 in the format DD,MM:";
232  INPUT A,B
233  IF A=0 THEN 190
235  PRINT "Input angle 2 in the format DD,MM:";
237  INPUT C,D
238  IF C=0 THEN 190
240  PRINT "Input the length of the opposing side:";
250  INPUT E
251  IF E=0 THEN 190
260  LET A1=A+B/60
270  LET B1=C+D/60
280  LET B=E
290  IF A1 <= 0 OR B1 <= 0 OR E <= 0 THEN 380
300  LET C1=180-(A1+B1)
310  LET A2=SIN(A1*K1)*E/SIN(B1*K1)
320  LET A=A2
330  LET C2=SIN(C1*K1)*E/SIN(B1*K1)
340  LET C=C2
350  IF C1 <= 0 OR A <= 0 OR C <= 0 THEN 380
360  GOSUB 1040
370  GOTO 130
380  PRINT "There is no triangle formed."
390  GOTO 130
400  REM SOLUTION OF AMBIGUOUS CASE
410  PRINT "Side-Side-Angle";LIN(1);"Input the length of side 1:";
412  INPUT A
413  IF A=0 THEN 190
415  PRINT "Input the length of side 2:";
416  INPUT B
417  IF B=0 THEN 190
420  PRINT "Input the size of the opposing angle in the format DD,MM:";
422  INPUT C,D
423  IF C=0 THEN 190
440  LET B1=B2=C+D/60
450  IF A <= 0 OR B <= 0 OR B2 <= 0 THEN 540
460  IF B2 >= 180 THEN 540
470  IF B<A*SIN(B1*K1) THEN 540
480  IF B=A*SIN(B1*K1) THEN 510
490  IF A>B AND B>A*SIN(B1*K1) THEN 590
500  IF A>B THEN 530
510  PRINT "Only one triangle is formed."
520  GOSUB 630
530  GOTO 130
540  PRINT "No triangle is formed."
550  GOTO 130
560  PRINT "Only one triangle is formed."
570  GOSUB 630
580  GOTO 130
590  PRINT "Two triangle are formed."
600  GOSUB 630
610  GOSUB 700
620  GOTO 130
630  LET A2=A*SIN(B1*K1)/B
640  LET A3=SQR(1-A2^2)
650  LET A1=ATN(A2/A3)*K2
660  LET C1=180-(A1+B2)
670  LET C=B*SIN(C1*K1)/SIN(B1*K1)
680  GOSUB 1040
690  RETURN 
700  LET A1=180-A1
710  LET C1=180-(A1+B2)
720  GOSUB 1040
730  RETURN 
740  PRINT "Side-Angle-Side";LIN(1);"Input the length of side 1:";
742  INPUT A
744  IF A=0 THEN 190
746  PRINT "Input the size of the included angle in the format DD,MM:";
748  INPUT B,C
750  IF B=0 THEN 190
752  PRINT "Input the length of side 2:";
754  INPUT D
756  IF D=0 THEN 190
770  LET C1=C+M/60
780  LET D=.5*(180-C1)*K1
790  LET R=(A-B)*TAN(D)/(A+B)
800  LET S=ATN(R)*K2
810  LET D=D*K2
820  LET A1=D+S
830  LET B1=D-S
840  LET C=A*SIN(C1*K1)/SIN(A1*K1)
850  IF C>0 THEN 870
860  GOTO 540
870  GOSUB 1040
880  GOTO 130
890  PRINT "Angle-Side-Angle";LIN(1);"Input the size of the first angle"
891  PRINT "in the format DD,MM:";
892  INPUT A,B
894  IF A=0 THEN 190
896  PRINT "Input the length of the included side:";
898  INPUT C
899  IF C=0 THEN 190
900  PRINT "Input the length of the second angle in the format DD,MM:";
902  INPUT D,E
904  IF D=0 THEN 190
910  LET A1=A+B/60
920  LET C1=C+D/60
930  LET B1=180-(A1+C1)
940  GOTO 280
950  PRINT "Side-Side-Side";LIN(1);"Input the length of side 1:";
951  INPUT A
952  IF A=0 THEN 190
953  PRINT "Input the length of side 2:";
954  INPUT B
955  IF B=0 THEN 190
956  PRINT "Input the length of side 3:";
957  INPUT C
958  IF C=0 THEN 190
970  LET S=.5*(A+B+C)
980  LET R=SQR((S-A)*(S-B)*(S-C)/S)
990  LET A1=2*ATN(R/(S-A))*K2
1000  LET B1=2*ATN(R/(S-B))*K2
1010  LET C1=2*ATN(R/(S-C))*K2
1020  GOSUB 1040
1030  GOTO 130
1040  IF INT(A1*100)/100=90 OR INT(B1*100)/100=90 THEN 1090
1050  IF INT(C1*100)/100=90 THEN 1090
1060  IF A1>90 OR B1>90 OR C1>90 THEN 1110
1070  PRINT "This is an acute triangle."
1080  GOTO 1120
1090  PRINT "This is a right triangle."
1100  GOTO 1120
1110  PRINT "This is an obtuse triangle."
1120  REM * Output *
1125  IMAGE 5X,3D.4D,3X,3D.4D,5X,3D.4D
1130  PRINT "      Degrees    Minutes      Lengths"
1140  PRINT  USING 1125;INT(A1),INT((A1-INT(A1))*6000)/100,A
1150  PRINT  USING 1125;INT(B1),INT((B1-INT(B1))*6000)/100,B
1160  PRINT  USING 1125;INT(C1),INT((C1-INT(C1))*6000)/100,C
1170  RETURN 
1180  CHAIN R,"*HELP"
1190  SYSTEM X,"BYE"
1200  END 
