Assuming that by "legs" you mean thew sides that aren't the hypotenuse, then just use the arctan function.
That is, you have tan(A) = 50/45 so A = atan(50/45) (i.e. tan-1(A))
$$\underset{\,\,\,\,^{\textcolor[rgb]{0.66,0.66,0.66}{360^\circ}}}{{tan}}^{\!\!\mathtt{-1}}{\left({\frac{{\mathtt{50}}}{{\mathtt{45}}}}\right)} = {\mathtt{48.012\: \!787\: \!504\: \!183^{\circ}}}$$
The other angle (B, say) is atan(45/50)
$$\underset{\,\,\,\,^{\textcolor[rgb]{0.66,0.66,0.66}{360^\circ}}}{{tan}}^{\!\!\mathtt{-1}}{\left({\frac{{\mathtt{45}}}{{\mathtt{50}}}}\right)} = {\mathtt{41.987\: \!212\: \!495\: \!817^{\circ}}}$$
You should check that these two sum to 90°