5. If one of the legs of a right triangle is 12, and the other two sides are integers, then the number of right triangles that meet this condition is ( ).
(A) 1
(B) 6
(C) 4
(D) infinitely many
5.C.

Let $a=12, c$ be the hypotenuse, then we have
$$
c^{2}-b^{2}=a^{2}=144 \text {. }
$$

Since $144=2^{4} \times 3^{2}$, we have
$$
\begin{array}{l}
(c+b)(c-b)=72 \times 2 ; \\
(c+b)(c-b)=36 \times 4 ; \\
(c+b)(c-b)=18 \times 8 ; \\
(c+b)(c-b)=16 \times 9 ; \\
(c+b)(c-b)=48 \times 3 ; \\
(c+b)(c-b)=24 \times 6 .
\end{array}
$$

Since $c+b$ and $c-b$ have the same parity, the right-angled triangles that meet the conditions are as follows:
$$
\left\{\begin{array} { l } 
{ a = 1 2 , } \\
{ b = 5 , } \\
{ c = 1 3 ; }
\end{array} \quad \left\{\begin{array} { l } 
{ a = 1 2 , } \\
{ b = 9 , } \\
{ c = 1 5 ; }
\end{array} \left\{\begin{array} { l } 
{ a = 1 2 , } \\
{ b = 1 6 , } \\
{ c = 2 0 ; }
\end{array} \left\{\begin{array}{l}
a=12, \\
b=35, \\
c=37 .
\end{array}\right.\right.\right.\right.
$$