A locomotive engine without a train can go 24 km an hour and its speed is diminished by a quantity, which varies as the square root of the number of wagons attached. With 4 wagons its speed is 20 km per hour. FInd the greatest number of wagons with which the engine can move.

f(0)= 24 and f(4)= 20. Its speed has been "diminished" by 4 and that is $k\sqrt{4}= 2k= 4$ so that k= 2. $24- k\sqrt{n}= 24- 2\sqrt{n}= 0$ gives $\sqrt{n}= 12$ which gives MaxJasper's answer.