# Formular of right angle triangle?

• Nov 5th 2011, 12:54 PM
uperkurk
Formular of right angle triangle?
What is the formular for a right angle triangle? I really struggle with formulars and I need to know the formular for a programming assignment I have been given.

I need the user to input 2 values, the width and the length, but I somehow need to calculate and display the height of the triangle, and also the 3 interior angles in degrees.

I have no problem with the coding I just dont know what the formular would be...

would it be something like:

height * width / 2......? Also I know I have to use the square root somewhere in the formular.
• Nov 5th 2011, 02:30 PM
pickslides
Re: Formular of right angle triangle?
I don't think a triangle has width, length and height. It has a height (a) base (b) and hypotenuse (c) the longest side.

Therefore $a^2+b^2=c^2$

For the angles you need to use sin, cos and tan, once you have labelled the sides opposite and adjacent the angles.
• Nov 5th 2011, 02:36 PM
uperkurk
Re: Formular of right angle triangle?
Im not allowed to measure anything, I should use python code to do this for me.

Here is what it says its not really that clear if im honest.

" write code to input two positive values of type float representing the width and the length of the diagonal of a right-angled triangle and calculate and display the height of the triangle, and also the three interior angles, expressed in degrees.
Pythagoras's theorem states that height2 = diagonal2-width2, so you should use this to calculate the square of the height, and then obtain its square root by calling the function sqrt from the math module.
You can obtain one of the interior angles by calling the function acos from the math module with an argument of width/diagonal; this will return the result in radians; to convert this to degrees the result must be passed as an argument to another function called degrees (also from the math module) which will return the required result. Since it is known that one of the angles is 90 degrees and the sum of the other two is 90 degrees we can now easily find all three angles."