From the text of the task we have:
smaller leg: x
longer leg: x+3
hypotenuse: x + 6
Using the Pythagorean Theorema:
[tex](x+6)^2=x^2+(x+3)^2\\
\\
x^2+12x+36=x^2+x^2+6x+9\\
\\
x^2-6x-27=0\\
\\
\Delta=(-6)^2-4.1.(-27)=36+108=144\\
\\
x=\frac{6 \pm \sqrt{144}}{2}=\frac{6 \pm 12}{2}\\
\\
x_1=-3\\
\\
x_2=9[/tex]
Obviously -3 is not possible, so, smaller leg is 9 cm