To solve for the other leg, you need to use Pythagorean theory.
The theory states that C^2 = A^2 + B^2
In your case, you have to solve for B.
C = 40 (hypotenuse) A = 24 (leg 1)
The formula rewritten for B is [tex]b= \sqrt{c^{2}-a^{2} }[/tex]
Now, you can solve.
[tex]b= \sqrt{c^{2}-a^{2} }
b= \sqrt{40^{2}-24^2 }
b = \sqrt{1600 - 576}
b = \sqrt{1024}
b = 32[/tex]
Therefore, B = 32.
So the second leg is 32 feet.