Gun in a fortress can can shoot missiles from a velocity of √(2gk).Gun is situated "h" meters high from the sea level.How to show that maximum horizontal range of a missile sent by the gun is 2√[k(k+h)] ?

I did this ,but not even close to the 2√[k(k+h)]

x=√(2gk)cos Θ*t

flying time : 0=√(2gk)Sin Θ*t - (g/2)tē

t=2 Sin Θ/g

x=√(2gk)cos Θ*2 Sin Θ/g

For the maximum range Θ has to be 45degrees

therefor

x=√(2gk)(1/√2)*2 (1/√2)/g

x=√(2gk)/g <<<so that has to be the Horizontal distance.What else.......

how am i supposed to get 2√[k(k+h)]