I would like to find a condition for an exact sequence of abelian groups $$ 0\to H\to G\to K\to 0 $$ to split. Assume for simplicity that $H=\langle h \rangle$ is cyclic, and choose a basis for $G= \langle g_1 \rangle \oplus \ldots \oplus \langle g_n \rangle$. Write $h= \sum a_i g_i$, with $0 \leq a_i < o(g_i)$, where $o(g_i)$ is the order of $g_i \in G$.
By looking at examples, it seems to me that the exact sequence splits if and only if $$ \gcd(o(h), a_1, \ldots, a_n)=1. $$ Is this last statement correct? (and, if so, why?)