Cosine Law Calculator

In my precalculus class, we had just gotten into the Law of Cosines and the Law of Sines. Granted this is an easy subject, but the pure amount of tedious work that goes into it is absolutely time-sucking. Instead I came up with a program which takes in 4 parameters, the sides of the triangle and one angle.

Since with the cosine law, you always know three of the four before mentioned parameters, you just plug 0 in for the parameter that you want to solve for. After that, the program will automatically rearrange the Cosine law and give you your answer. This is the source code for the program:

Prompt A
Prompt B
Prompt C
Prompt θ

If A≤0
Then
Disp "A:"
Disp √(B²+C²-2*(B)*(C)*cos(θ))

Else
Disp "θ:"
Disp cos((A²-B²-C²)/(­2*B*C))

End

A side note: I never use this on a test, as I always have to do work. I just prefer to use this on homework and word problems, as I already know the material, and want to sleep at a reasonable time :D.