Let $G$ be a group, and $C$ a subgroup of $G$ which is contained in the center of $G$. Suppose there exists a group homomorphism $f: G \longrightarrow C$ such that $f(c) = c$ for all $c \in C$. Let $K$ denote the kernel of $f$. Prove that $G$ is isomorphic to $K \times C$.
I believe the route to go here is to use the following theorem: Let $G$ be a group with normal subgroups $H,J$ such that $HJ = G$ and $H \cap J = \{e\}$. Then $G \cong H \times J$.
As the kernel of a group homomorphism from $G$ to $C$, it's clear that $K$ is a normal subgroup of $G$. Furthermore, any subgroup of $Z(G)$ is normal in $G$, so $C$ is normal in $G$. It's left to show that $KC = G$ and $K \cap C = \{e\}$. How can I show these last two points ? It's not clear to me why the set $\{kc | k \in K, c \in C\}$ is all of $G$, or why there are no nonidentity elements that lie in both $K$ and $C$.
Any help would be appreciated.
Thanks!