3. B.
$$
y=(\sin x)\left|\frac{\cos x}{\sin x}\right|=\left\{\begin{array}{ll}
\cos x, & 0<x<\frac{\pi}{2} \\
0, & x=\frac{\pi}{2} \\
-\cos x, & \frac{\pi}{2}<x<\pi
\end{array}\right.
$$
3. The graph of the function $y=(\sin x)\left|\frac{\cos x}{\sin x}\right|(0<x<\pi)$ is roughly ( ).
(A)
(C)
(B)
(D)