By the Pythagorean Theorem, the hypotenuse squared is equal to the sum of the sides squared...
h^2=x^2+y^2
We are told that y=x+20 and h=24 so
x^2+(x+20)^2=24^2
x^2+x^2+40x+400=576
2x^2+40x+400=576
2x^2+40x=176
x^2+20x=88
x^2+20x+100=188
(x+10)^2=188
x+10=±√188
x=-10±√188, x>0 so
x=-10+√188 ft
y=10+√188 ft
If you want approximations...
x≈3.71 ft
y≈23.71 ft