10 PRINT "PARTS OF A TRIANGLE"
20 PRINT
30 DIM A(3),S(3)
31 REM - SET VALUE OF PI
40 P=3.1415927
48 REM - ENTER NUMBER OF PROBLEM TYPE ACCORDING TO KNOWN PARTS
49 REM - OF THE TRIANGLE WHERE A=ANGLE, S=LENGTH OF SIDE
50 PRINT "PROBLEM TYPES: 1=ASA,2=SAS,3=AAS,4=SSA,5=SSS,6=END PROGAM"
60 PRINT "ENTER PROBLEM TYPE";
70 INPUT X
79 REM - DIRECT PROGRAM TO PROPER CALCULATIONS
80 IF X=6 THEN 560
90 IF X=5 THEN 390
100 IF X=4 THEN 300
110 IF X=3 THEN 260
120 IF X=2 THEN 190
130 PRINT "ENTER ANGLE,SIDE,ANGLE";
140 INPUT A(1),S(3),A(2)
150 A(3)=P-A(1)-A(2)
160 S(1)=S(3)*SIN(A(1))/SIN(A(3))
170 S(2)=S(3)*SIN(A(2))/SIN(A(3))
180 GOTO 440
190 PRINT "ENTER SIDE,ANGLE,SIDE";
200 INPUT S(3),A(1),S(2)
210 S(1)=SQR(S(3)[2+S(2)[2-2*S(3)*S(2)*COS(A(1)))
220 A(2)=SIN(A(1))/S(1)*S(2)
230 A(2)=ARCSIN(A(2))
240 A(3)=P-A(1)-A(2)
250 GOTO 440
260 PRINT "ENTER ANGLE,ANGLE,SIDE";
270 INPUT A(3),A(2),S(3)
280 A(1)=P-A(2)-A(3)
290 GOTO 160
300 PRINT "ENTER SIDE,SIDE,ANGLE";
310 INPUT S(1),S(2),A(1)
320 T=S(2)*SIN(A(1))
330 IF S(1)<T THEN 520
340 S(3)=SQR(S(2)[2-T[2)
350 IF S(1)<=T THEN 380
360 Y=SQR(S(1)[2-T[2)
370 S(3)=S(3)+Y
380 GOTO 220
390 PRINT "ENTER SIDE,SIDE,SIDE";
400 INPUT S(1),S(2),S(3)
410 A(1)=(S(2)[2+S(3)[2-S(1)[2)/2/S(2)/S(3)
420 A(1)=ARCCOS(A(1))
430 GOTO 220
440 PRINT
449 REM - PRINT RESULTS
450 FOR I=1 TO 3
459 REM - THE ANGLE OF A TRIANGLE CANNOT BE LESS THAN ZERO
460 IF A(I)<0 THEN 520
470 PRINT "SIDE";I;"=";INT(S(I)*1000+.5)/1000
480 PRINT "OPPOSITE ANGLE=";INT(A(I)*1000.5)/1000;"RADIANS"
490 NEXT I
500 PRINT
510 GOTO 60
520 PRINT
530 PRINT "NO SOLUTION"
540 PRINT
550 GOTO 60
560 END
