So this is a right triangle
We can solve using the Pythagorean Theorem
We know that the wall is perpendicular to the ground and the ladder is leaning onto it.
We will say that the ladder is the hypotenuse
a^2 + b^2 = c^2
2^2 + b^2 = 10^2
4 + b ^2 = 100
subtract 4 from both sides
b^2 = 96
then we take the square root
b = 9.79 ft
or 9.8 ft
or 10 ft
(that is depending on how much you need to round)
Hope this helps :)