The problem says that $$N=a_m.10^m+a_{m-1}.10^{m-1}+...+a_1.10+a_0$$ is divisible by $5$ iff $a_0=0$ or $5$.
Here is my approach.
It's obvious that $a_0$ must be $0$ or multiple of $5$. I have shown, $$N=a_m.10^m+a_{m-1}.10^{m-1}+...+a_1.10+a_0\equiv a_0\mod 5\\ \Rightarrow N\equiv a_0 \mod 5\\ \therefore N-5=a_0\\ 10.m-5=a_0$$, where $N=10.m$.
Putting $m=1,2,3,..$ etc we get $a_0=5$. It is obvious $a_0=0$ also. Hence the proof.
Now here I have doubt. is it correct to assume $N=10.m$? I am not sure. Please correct me if I'm wrong. Any alternative approach will also be helpful.
It should be $$N\equiv a_0\pmod5\implies a_0-N\equiv a_0\equiv0\pmod5$$ as $5\mid N$. Otherwise, your solution is fine.
More concisely,