you use the formula A2 + B2 = C2. C is the longest side of the triangle. The other two dont really matter where you place them, in either A or B.
In case you dont know how to solve it, ill give you an example:
A2 + B2 = C2
22 + 42 = C2 substitute
4 + 16 = C2 simplify
20 = C2 add
4.472 = C square both sides