A very similar Ask entry had link to a diagram, which is critical to the solution because the 40o angle is not from the normal but from the lower left side of the prism, below where the ray enters the prism. If this is true for the un-shown diagram of this Ask, then the following is the multi-step solution --
At left entrance into prism, let ϑ1 be incoming angle to the normal which is 50o, and ϑ2 be refracted angle relative to normal inside prism. Index of refraction in air is taken to be n1 = 1.00 and in prism is given as n2 = 1.50.
Snell’s Law gives n2 sin ϑ2 = n1 sin ϑ1 from which sin ϑ2 = (1.00 sin 50) / 1.50 = 0.5107, so ϑ2 = 30.71o. Let α be the angle from refracted ray to upper left side of prism, so that α = 90 - ϑ2 = 59.29o. Let β be the angle at right side between refracted ray and inside upper right side of prism; β = 180 – 70 – 59.29 = 50.71o. Now angle of ray to normal on inside right side ϑ3 = 90 – β = 39.29o.
Letting ϑ4 be the angle “?” to be determined, n1 sin ϑ4 = n2 sin ϑ3 and sin ϑ4 = (1.50 sin 39.29)/ 1.00 = 0.9499. Finally ϑ4 = 71.8o.