the ladder makes a rectangle triangle with the floor and wall, the ladder is the hypothenuse. So we use Pythagoras theorem: the square of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the other two sides
So we have:
hyp^2 = wall^2 + floor^2
and plugging data in:
18^2 = wall^2 + 7^2
324 = wall^2 + 49
wall^2 = 275
wall = 16.58