5. The number of right-angled triangles with integer lengths of the two legs and whose perimeter is numerically equal to an integer multiple of its area is ( ).
(A) 1
(B) 2
(C) 3
(D) infinitely many
5. (C).

Let the two legs of the right triangle be positive integers $a, b(a \leqslant b)$. Then, by the problem, we have $a+b+\sqrt{a^{2}+b^{2}}=k \cdot \frac{1}{2} \cdot a b$. ( $k$ is a positive integer) Rearranging and squaring both sides, we get
$$
\begin{array}{l}
(k a-4)(k b-4)=8 . \\
\text { Therefore }\left\{\begin{array} { l } 
{ k a - 4 = 1 , } \\
{ k b - 4 = 8 }
\end{array} \text { or } \left\{\begin{array}{l}
k a-4=2, \\
k b-4=4 .
\end{array}\right.\right.
\end{array}
$$

Starting from this, $\left\{\begin{array}{l}a=5, \\ b=12, \\ k=1\end{array}\right.$ or $\left\{\begin{array}{l}a=6, \\ b=8, \\ k=1\end{array}\right.$ or $\left\{\begin{array}{l}a=3, \\ b=4, \\ k=2 .\end{array}\right.$
Therefore, there are three such right triangles.