This is the concept of application of Pythagorean theorem and algebra;
Suppose the the length of the ladder is x ft, the distance from the ground to the top of the ladder will be (x-8) ft, the distance from the bottom of the ladder to the building is 16ft, thus to find the length of the ladder we proceed as follows;
c^2=a^2+b^2
x^2=(x-8)^2+16^2
x^2=x^2-16x+64+256
collecting the like terms we get:
x^2-x^2+16x=320
16x=320
solving for x we get:
x=320/16
x=20 ft
the answer is x=20 ft