Let the base and height of the right triangle be b and h respectively.
Then the area of the triangle (which is to be maximized) is
A = bh/2. Draw the triangle with the right angle positioned at the origin, in the first quadrant.
We are told that the hypotenuse is 5 cm. Then
b^2 + h^2 = 25 cm^2 must be true. Alternatively, b = sqrt(25-h^2).
We want to meximize the area of this triangle. In other words, maximize
A = (b)(h)/2, or, equivalently, maximize A = [sqrt(25-h^2)](h)/2.
Maximize A by differentiating the above formula for A with respect to h and finding the critical value for h. Once you have that h value, calculate the corresponding b value and find the max area via A = bh/2.