This can be solve by functions of a right triangle the tan(theta) which is equal to opposite side/ adjacent side
which the opposite side is the height that we looking for.
and the adjacent side is the distance from his feet to the bottom of the mountain

let h the height of the mountain
and d is the distance of the person from the mountain from the first measurement

at first situation measurement
tan (40) = h/d
and make d in terms of h
by algebra skills
d = h/tan (40)

at the second situation he move 0.5m farther so it will plus to the distance at the first situation
then it becomes
tan (34) = h/d +0.5
then manipulate the equation
you have the value of d at the first situation so just substitute the d
then it becomes
tan (34) = h / (h/tan40) + 0.5
then solve the h by your algebraic skills
tan34 (h/tan40 + 0.5) =h
distribute the tan(34)
h tan34/tan40 + (0.5)tan34 = h
combine like terms
0.5(tan34) = h (1 - tan34/tan40 )
then you get the h
h = 0.5(tan34)/(1 - tan34/tan40 )

h = 1.719 m
and tell your teacher that it is not mountain it is punso haha joke..

I hope it helps you !

I got an answer of 2.1m
i think this is the right answer can you show me your solution?
I solved it again, I got your answer. Thanks!!
no problem