you need to use pythogoras theorem for this. imagine the leaning ladder as the hypotenuse, the wall as the height and the bottom of the ladder to the wall's base as the length.
so for now the length is the unknown. therefore,
length = sqrt (5^2 - 4^2)
length = sqrt 9
length = 3 foot
3ft is the answer