Product in category of cyclic groups. I know that if $ G_1, G_2 $ are cyclic groups then $ G_1 \times G_2 $ is cyclic if and only if $ |G_1| $ and $ |G_2| $ are coprimes. But I have to reponds a similar question in the context of category theory: 
show that $ \mathbb{Z}_n $, $ \mathbb{Z}_m $ have a product in the category of cyclic groups if and only if $ n, m $ are coprimes.
For the implication $ \leftarrow \ $ I consider that $ n,m $ coprimes $ \rightarrow \mathbb{Z}_n \times \mathbb{Z}_m $ is cyclic, so this group is an element of the cateogory. Now we can take the proyection 
$$
p_1 : \mathbb{Z}_n \times \mathbb{Z}_m \rightarrow \mathbb{Z}_n 
,\ \ \ \
p_1(x,y) = x
$$ 
and 
$$ 
p_2 : \mathbb{Z}_n \times \mathbb{Z}_m \rightarrow \mathbb{Z}_m
, \ \ \ \
p_2(x,y) = y 
$$
that are homomorphism. Easily I can show that $ \mathbb{Z}_n \times \mathbb{Z}_m $ and $ p_1, p_2 $ form a product of $ \mathbb{Z}_n $ and $ \mathbb{Z}_m $  in the category of cyclic groups.
But I am stuck in the proof of the implication $ \rightarrow $.
 A: This should also follow from a naive count of the number of homomorphisms between cyclic groups: specifically, $$\lvert \operatorname{Hom}(\mathbb{Z}_a, \mathbb{Z}_b) \rvert = \gcd(a,b).$$
Suppose $\mathbb{Z}_p$ is the product of $\mathbb{Z}_m$ and $\mathbb{Z}_n$ in the category of cyclic groups.  Then it satisfies universal property $$\operatorname{Hom}(\mathbb{Z}_t, \mathbb{Z}_p) \cong \operatorname{Hom}(\mathbb{Z}_t, \mathbb{Z}_m) \times \operatorname{Hom}(\mathbb{Z}_t, \mathbb{Z}_n)$$ for all $t$.  Counting both sides, we obtain the relation $$\gcd(t,p) = \gcd(t,m) \cdot \gcd(t,n)$$ for all $t$.  In particular, if $t = m$, we get $$\gcd(m,p) = m \cdot \gcd(m,n).$$ The left hand side is at most $m$, but in case $m, n$ are not coprime, $\gcd(m,n) > 1$, and the right hand side is strictly bigger than $m$.  This would give a contradiction.  
A: I think you can use the fact that every finite abelian group can be written as $(\mathbb{Z}_{n_1})^{\oplus m_1}\oplus\cdots\oplus (\mathbb{Z}_{n_i})^{\oplus m_i}$. So suppose now that $A$ is a categorical product of $\mathbb{Z}_n$ and $\mathbb{Z}_m$ in the category of cyclic groups, and let us show that it is also a categorical product in the category of finite abelian groups :
Let $X$ be a finite abelian group, together with two maps $X \to \mathbb{Z}_m$ and $X\to \mathbb{Z}_n$. Writing $X = (\mathbb{Z}_{n_1})^{\oplus m_1}\oplus\cdots\oplus (\mathbb{Z}_{n_i})^{\oplus m_i}$, and precomposing by the various inclusions, we get a families of maps $f_{n_k}^j : \mathbb{Z}_{n_k}\to\mathbb{Z}_n$ and $g_{n_k}^j : \mathbb{Z}_{n_k}\to\mathbb{Z}_m$, for $j\leq m_k$. We can now use the universal property of the product in the category of cyclic groups for each pair $(f_{n_k}^j,g_{n_k}^j)$ to get maps $h_{n_k}^j : \mathbb{Z}_{n_k}\to A$. Now let us this this family of maps for the universal property of the coproduct in the category of finite abelian groups, to get a map $h : X\to A$. You can prove that this map commutes with the initial $f,g$ modulo the projection (this is a trivial diagram, if you have understood the above construction).
So if $A$ is a categorical product in the category of cyclic group, it is also a categorical product in the category of finite abelian groups, and thus it is given by the cartesian product of groups.
This proof presuppose that you already know that $\times$ and $\oplus$ are respectively the product and coproduct in the category of finite abelian groups, but I think these are easier results.
