We prove that for every $a\in(0,1)$ we have $$\lim_{x\to a}f(x)=0$$
from where we'll see it is only continuous at the irrational points. So, let's pick any $a\in(0,1)$, and let us be given $\epsilon >0$. Choose $n$ so that $1/n\leq \epsilon$.
First, we note that the only points where it might be false that $|f(x)-0|<\epsilon$ are $$\frac{1}{2};\frac{1}{3},\frac{2}{3};\frac{1}{4},\frac{3}{4};\frac{1}{5},\frac{2}{5},\frac{3}{5},\frac{4}{5}; \cdots ;\frac{1}{n}, \cdots ,\frac{{n - 1}}{n}$$ If $a$ is rational, then $a$ could be one of those numbers. But, as many as there can be, the amountof these numbers are finite. Thus, for some $p/q$ in that list, the number $$|a-p/q|$$ is least. If $a$ is one of these numbers, consider $p/q\neq a$. Then, take $\delta$ as this distance. It will then be the case that if $0<|x-a|<\delta$, then $x$ will be none of the numbers
$$\frac{1}{2};\frac{1}{3},\frac{2}{3};\frac{1}{4},\frac{3}{4};\frac{1}{5},\frac{2}{5},\frac{3}{5},\frac{4}{5}; \cdots ;\frac{1}{n}, \cdots ,\frac{{n - 1}}{n}$$
thus it will be true that $|f(x)-0|<\epsilon$.
You can find another interesting example here.