

Let,
Initial velocity of the ball = U
Distance travelled in the nth sec is given by,
Sn = U + 1/2 x a x (2n-1)
Distance coverder in the 5th sec is,
S5 = u + 1/2 x 10 x (2 x 5 -1) = U - 45
Distance covered in 8th sec
S8 = u + 1/2 x 10 x (2 x 8 -1) = U - 60
Now find the U to get accurate condition.
