lordzee lordzee - 7 days ago 5
Java Question

Simple Way to get angles

I made a program that asks the user for 3 lengths and determines if it is equilateral,scalene, isosceles. I want to know how to calculate angles(all 3 sides are given) in Java so that the program determines if it is obtuse or acute or right-angled.Please help me out.

Answer

As you know the sides of the triangle, you can find the angles just by following steps below...

In java you can use Math.acos(val) to calculate the Inverse Cosine.

Comments