They are right triangles so you can use the Pythagorean theorem.
A = sqrt(5^2+3^2)
A = sqrt(25+9)
A = sqrt(34) (exact answer)
As a decimal it would be: 5.8
B = 45 = sqrt( 20^2 + b^2)
B^2 = 45^2-20^2
B^2 = 2025-400
B^2 = 1625
B = sqrt(1625)
B = 5sqrt(65) exact answer
As a decimal : 40.3