$\mathbb{Z}_m \times \mathbb Z_n$ is cyclic if and only if $\gcd(m,n)=1$ [closed]

Let $m,n$ be positive integers bigger than $1$. Show that $\mathbb{Z}_m \times \mathbb Z_n$ is cyclic if and only if $\gcd(m,n)=1$.

I have no idea on how to start. Anyone hints are much helpful.


Hint 1: Suppose $d = \gcd(m,n) > 1$. Then $k = \frac{mn}{d}$ is an integer (why?) and every element of $\mathbb{Z}_m \times \mathbb{Z}_n$ has order dividing $k$ (why?). Conclude that $\mathbb{Z}_m \times \mathbb{Z}_n$ cannot be cyclic in this case.

Hint 2: Suppose $d = \gcd(m,n) = 1$. Consider the element $(1,1) \in \mathbb{Z}_m \times \mathbb{Z}_n$ and compute its order. Conlcude that $\mathbb{Z}_m \times \mathbb{Z}_n$ is cyclic in this case.