Let
$$f_n(x) = \begin{cases} 0, & \text{if } x<\frac{1}{n+1} \\ \sin \frac{\pi}{x}, & \text{if } \frac{1}{n+1}\le x\le\frac{1}{n} \\ 0, & \text{if } x>\frac{1}{n}. \end{cases}$$
Show that $f_n(x)$ converges to a continuous function but not uniformly.
I do not know how to proceed with this. Any help/hint would be appreciated.
We show that $f_n\to 0$ pointwise, but not uniformly.
Suppose $x\in\mathbb{R}$. If $x\leq 0$ then $f_n(x)=0$ for all $n$. If $x>0$, we can choose $N\in\mathbb{N}$ such that $1/N<x$. In this case, we have $f_n(x)=0$ for all $n\geq N$. Therefore $f_n(x)\to0$ for all $x\in\mathbb{R}$, which means that $f_n\to 0$ pointwise.
To see that $f_n\not\to0$ uniformly, note that for every $n\in\mathbb{N}$, we have $$ \sup_{x\in\mathbb{R}} |f_n(x)| = 1. $$ Indeed, fix $n\in\mathbb{N}$ and take $x:=\frac{1}{n+1/2}$. Then $x$ satisfies $1/(n+1) \leq x \leq 1/n$, and so $$ |f_n(x)| = |\sin\left(\frac{\pi}{x}\right)| = |\sin(n\pi+\pi/2)| = 1. $$