Solution
= Solution
Let $I_n$ denote the <integral> with the <cosine> factor and $J_n$ the one with the <sine> factor. In <integration by parts>, take $u=\cos(nx)$ and $dv=e^x\,dx$. Then
$$
I_n=[e^x\cos(nx)]_0^\pi+nJ_n=\boxed{(-1)^ne^\pi-1+nJ_n}.
$$
The integer restriction gives $\cos(n\pi)=(-1)^n$.