Show that the center of a direct product is the direct product of centers:

$\displaystyle Z(G_1$ x $\displaystyle G_2$ x ... x $\displaystyle G_n)=Z(G_1)$ x $\displaystyle Z(G_2)$ x ... x $\displaystyle Z(G_n)$.

Deduce that a direct product of groups is abelian if and only if each of the factors is abelian.

I know that $\displaystyle G_1 $x $\displaystyle G_2$ x ... x $\displaystyle G_n$ is isomorphic to $\displaystyle G_1G_2...G_n$.