Let $(x_1,\dots,x_r)$ be a non-zero element of $\mathbb{Z}^r$, and let $h$ be the highest common factor of $x_1, \dots, x_r$. Show that: $ \mathbb{Z}^r/\langle(x_1,\dots,x_r)\rangle \cong \mathbb{Z}^{r-1} \oplus (\mathbb{Z}/h\mathbb{Z}). $
Now, the previous part of the question implies that I can find an isomorphism $\phi:\mathbb{Z}^r \to \mathbb{Z}^r$ taking $(x_1,\dots,x_r)$ to $(h,0,\dots,0)$, and I am supposed to 'deduce' this part from that. An answer on my other question led me to the following: let $H$ be the cyclic subgroup of $\mathbb{Z}^r$ generated by $(x_1,\ldots,x_r)$. If $(y_1,\dots,y_r)$ is a torsion element of $\mathbb{Z}^r/H$ then $ n(y_1,\dots,y_r) = (x_1,\dots,x_r), $ but then $n|x_i$ for all $i$, so $n|h$. This feels like it is along the right lines, but something seems off. If it were $h|n$ instead, wouldn't that give the answer? Can someone point me in the right direction?