sin Example
10! This example deminstrates the usage of the trigonometric
20! functions. The following triangle will be used:
30!
40! |\
50! |a \ Given C = 5 units and angle c = 35 degrees
60! C| \B
70! |b c\ Note: angle b = 90 dgrees.
80! +--------
90! A
100 CLEAR SCREEN
110 DEG ! get in degree mode
120 REAL A,B,C
130! Given:
140 C=5.0
150 Angle_b=90
160 Angle_c=35
170! Angle a can be found by simply subtracting the total given
180! angles by 1800 degrees. Every triangle only has 180
190! degress.
200 Angle_a=180-(Angle_c+Angle_b)
210! The sine of angle c is definded as C over B. Solving for
220! B gives us:
230 B=C/SIN(Angle_c)
240! The cosine of angle c is definded as A over B. Solving for
250! A gives us:
260 A=B*COS(Angle_c)
270! To double check the answers, onte posible way is:
280! Given: A^2 + C^2 = B^2 and solving for C
290 X=SQR(B^2-A^2)
300 X=DROUND(X,1)
310 IF X=C THEN
320 PRINT "The leg A =";A;"units."
330 PRINT "The leg B =";B;"units."
340 PRINT "The leg C =";C;"units."
350 PRINT "Angle a is = ";Angle_a;"degrees."
360 PRINT "Angle b is = ";Angle_b;"degrees."
370 PRINT "Angle c is = ";Angle_c;"degrees."
380 ELSE
390 PRINT "An error has occured."
400 END IF
410 END