A point is 34meter due east of a point y. The bearing of a flags pole from x and y are north 18 degree east and north 40 degree east respectively . calculate the the distance of the flag pole from y

If you meant to say that X is 34m due east of Y, then

draw a diagram, with the pole at point P. It should be clear that
YP/sin50° = 34/sin22°