Example 2 If the function
$$
y=\frac{1}{2}\left(x^{2}-100 x+196+\left|x^{2}-100 x+196\right|\right),
$$

then when the independent variable $x$ takes the natural numbers $1,2, \cdots, 100$, the sum of the function values is ( ).
(A) 540
(B) 390
(C) 194
(D) 97
(1999, National Junior High School Mathematics Competition)
Solution: Since $x^{2}-100 x+196=(x-2)(x-98)$, therefore, when $2 \leqslant x \leqslant 98$,
$$
\left|x^{2}-100 x+196\right|=-\left(x^{2}-100 x+196\right) \text {. }
$$

Thus, when the independent variable $x$ takes $2,3, \cdots, 98$, the function value is 0; and when $x$ takes $1,99,100$, the sum of the function values is $(1-2)(1-98)+(99-2)(99-98)+$ $(100-2)(100-98)=390$. Therefore, the answer is (B).