I am pretty sure that it has been already discussed many times, but I couldn't find.
Well, the problem is to show that $\mathrm{Hom}(\mathbb Z/n\mathbb Z, \mathbb Z/m\mathbb Z)\simeq\mathbb Z/(n,m)\mathbb Z$.
I have proven that $Hom(Z/nZ, Z/mZ)$ is precisely $Ann(nZ) = \{x \in Z/mZ: nx = 0\}. $ Thus my problem reduces to proving $Ann(nZ) = Z/(n,m)Z$, but I haven't gotten success so far.