I get $\displaystyle \displaystyle{a_n=\frac{1}{\pi}\int\limits^\pi_0 \sin t\cos nt\,dt=\frac{1}{\pi}\int\limits^\pi_0\left[\sin(n+1)t-\sin(n-1)t\right]dt=}$
$\displaystyle \dispaystyle{\frac{1}{\pi}\left[-\frac{1}{n+1}\cos(n+1)t+\frac{1}{n-1}\cos(n-1)t\right]^\pi_0=}$
$\displaystyle \displaystyle{=\frac{(-1)^{n+1}-1}{\pi}\cdot\frac{2}{n^2-1}=\left\{\begin{array}{cc}0&\mbox{, if }n\mbox{ is odd}\\-\frac{4}{\pi(n^2-1)}&\mbox{ , if }n\mbox{ is even}\end{array}\right.}$ , so I think both
answers are wrong...or I am, of course.
Tonio