Question 29982
Label the three sides as a,b,c, and let a be the hypotenuse.

Suppose a = 8.
Since a is the hypotenuse, then the shortest the other two sides could be is 16 units each, and there is no way that 16² + 16² = 8².
In other words, the side of length 8 cannot be a hypotenuse so it must be one of the other sides.
let c = 8, say.

The perimeter: a + b + c = 40
i.e. a + b = 32
===============

Pathagoras' theorem: a² = b² + c²
i.e. a² = b² + 64
=================

Now substitute for a = 32 - b into the quadratic eqn and solve for a.