Suppose the man was initially ‘x’ m away from the hill. Let the speed of sound be ‘v’.
Initially, sound comes back to the man in 4.7 s, so,
4.7 = 2x/v
=> x = 4.7v/2
Then after moving 310 m towards the hill, sound comes back in 3 s,
2.9 = 2(x-300)/v
=> 2.9 v = 2x – 600
=> 2.9 v = 4.7v – 600
=> v = 333.3 m/s
This is the speed of sound.