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))
tan360∘−1(5045)=48.012787504183∘
The other angle (B, say) is atan(45/50)
tan360∘−1(4550)=41.987212495817∘
You should check that these two sum to 90°