Answer
$12$ cm
$16$ cm
Work Step by Step
Let's note by $x$ and $y$ the lengths pf the triangle's legs.
Using Pythagora's theorem we have:
$$x^2+y^2=20^2=400.$$
We use the given information and we obtain the system of equations:
$$\begin{cases}
x^2+y^2&=400\\
x+y&=28.
\end{cases}$$
We substitute $y=28-x$ in the first equation and solve for $x$:
$$\begin{align*}
x^2+(28-x)^2&=400\\
x^2+784-56x+x^2-400&=0\\
2x^2-56x+384&=0\\
2(x^2-28x+192)&=0\\
x^2-28x+192&=0\\
(x-12)(x-16)&=192\\
x-12=0&\text{ or }x-16=0\\
x=12&\text{ or }x=16.
\end{align*}$$
We determine the other leg $y$:
$$\begin{align*}
x=12&\Rightarrow y=28-12=16\\
x=16&\Rightarrow y=28-16=12.
\end{align*}$$
The legs are $12$ cm and $16$ cm.