<s>[INST] It is an easy question about integral,but I need your help. How to compute this integral?

$$ \int^{\pi}_{0} \frac{\sin(nx)\cos\left ( \frac{x}{2} \right )}{\sin \left ( \frac{x}{2} \right ) } \, dx$$

I need your help.
 [/INST] Hint:
$\int_0^{\pi}\dfrac{\sin nx . \cos \dfrac{x}{2}}{\sin \dfrac{x}{2}}=\int_0^{\pi}\dfrac{\sin n(\pi -x) . \sin \dfrac{x}{2}}{\cos\dfrac{x}{2}}=1$
$\sin (n \pi-nx)=\sin n{\pi} \cos nx-\cos{n \pi}\sin{nx}= (-1)^{n+1}\sin nx$,
$2I=\int_0^{\pi}\dfrac{\sin nx}{\cos \dfrac{x}{2} \cdot \sin \dfrac{x}{2}}$, when $n \in$ Even
$2I= \int_0^ \pi \dfrac{\sin nx \cdot \cos x}{\cos \dfrac{x}{2} \cdot \sin \dfrac{x}{2}}$, when $n \in$ Odd.   Since we know $\cos^2\dfrac{x}{2}-\sin^2\dfrac{x}{2}=\cos x$
</s>