The following theorem and its proof is from A First Course in Algebraic Topology By Czes Kosniowski pp. 219-220 http://books.google.jo/books?id=vvU3AAAAIAAJ&printsec=frontcover&source=gbs_ge_summary_r&cad=0#v=onepage&q&f=false
I have only one comment on the following proof. In the last two lines: $\mathbb Z_m \times \mathbb Z_n \cong \mathbb Z_{m'}\times \mathbb Z_{n'}$ iff $\{n,m\}=\{n',m'\}$ because $gcd (n.m)=1$, and $gcd(m',n')=1$. I don't think that is precise!!
Do you know how last statement in the proof should be in order to have correct proof?

Well, you're right, it's not true as stated. (I mean the argument in the last sentence; the result itself is, of course, true.) For example, take $m = 6, n = 5$ and $m^{\prime} = 3, n^{\prime} = 10$. Then $\mathbb{Z}_{m}\times\mathbb{Z}_{n}\simeq \mathbb{Z}_{30}\simeq\mathbb{Z}_{n^{\prime}}\times\mathbb{Z}_{m^{\prime}}$. But you can get from $\langle x\mid x^m\rangle\ast\langle y\mid y^n\rangle\simeq\langle u\mid u^{m^{\prime}}\rangle\ast\langle v\mid v^{n^{\prime}}\rangle$ to $\{m,n\} = \{m^{\prime},n^{\prime}\}$ by properties of the free product.
Let's identify the isomorphic groups $\langle x,y\mid x^m, y^n\rangle = \langle u,v\mid u^{m^{\prime}}, v^{n^{\prime}}\rangle$. Now, $u$ is an element of finite order $m^{\prime}$, so it is conjugate to an element of $\langle x\rangle$ or of $\langle y\rangle$. In particular, the order $m^{\prime}$ of $u$ divides either $m$ or $n$ and, since $m$ and $n$ are relatively prime, it divides exactly one of them. Say, without loss of generality, that $m^{\prime}$ divides $m$. Similarly, $v$ is conjugate to a power of either $x$ or $y$ so, by coprimality again, $v$ is a power of $y$, and so its order $n^{\prime}$ divides $n$. By symmetry, we also have that $m$ divides $m^{\prime}$ and $n$ divides $n^{\prime}$. Thus, $m = m^{\prime}$ and $n = n^{\prime}$.