5. The number of ordered pairs of integers $(a, b)$ that make the three numbers $a+5$, $b-2$, and $a+b$ the lengths of the sides of a right triangle is ( ).
(A) 0
(B) 1
(C) 2
(D) 3
5.A.

If $a+5$ is the hypotenuse, then
$$
(a+5)^{2}=(a+b)^{2}+(b-2)^{2} \text {. }
$$

Rearranging gives $2 a(5-b)=2 b(b-2)-21$.
The left side is even, while the right side is odd, leading to a contradiction.
If $a+b$ is the hypotenuse, then
$$
(a+b)^{2}=(a+5)^{2}+(b-2)^{2} .
$$

Rearranging gives $2(a b-5 a+2 b)=29$, leading to a contradiction.
If $b-2$ is the hypotenuse, then
$$
(b-2)^{2}=(a+5)^{2}+(a+b)^{2} \text {. }
$$

Rearranging gives $2\left(a^{2}+a b+5 a+2 b\right)=-21$, leading to a contradiction. Therefore, there are no positive integer solutions for $a$ and $b$ that satisfy the problem's requirements.