5. In the geometric sequence $\left\{a_{n}\right\}$, $q$ is the common ratio $(0<|q|<1)$. $S_{n}$ is the sum of the first $n$ terms, and $S=\lim _{n \rightarrow \infty} S_{n}$. Which of the following statements is correct? ( ).
(A) $S_{n}=S\left(1-q^{n}\right)$
(B) $a_{n}=S\left(1-q^{n}\right)$
(C) $a_{n}$ is monotonically decreasing and tends to zero
(D) $S_{n}$ is monotonically decreasing and tends to $S$
5. From $S=\frac{a_{1}}{1-q}$, we know $S_{n}=\frac{a_{1}\left(1-q^{n}\right)}{1-q}=S\left(1-q^{n}\right)$.