It is to be proven that if $k|n$ and $\phi: Z_n \to Z_k$ is defined by $\phi (x)=x\mod k $, then $\phi$ is a homomorphism.
$\phi$ is well defined as: $x=y\implies x\mod k=y \mod k$
To prove that $\phi$ is operation preserving, let $x,y \in Z_n$, it is possible that $x+y \notin Z_n$ so we consider
$\phi ((x+y) \mod n)=((x+y)\mod n)\mod k \tag{1}$
I got stuck here. I want to show that $\phi ((x+y) \mod n)=\phi(x)+\phi (y) \tag{2}$.
The problem is that since in general, $(x+y) \mod n \mod k \ne (x+y) \mod k \mod n$ and also $(x+y) \mod n=(x\mod n+ y\mod n) \mod n$, I don't know how to show that $(1)$ implies $(2)$.
Thanks for your time.
My suggestion is to convert the $\rm mod$ notation into a more transparent form.
An element $x \in \mathbb{Z}_n$ is an equivalence class $[x]_n$ of integers of the form $x+an$ for $a \in \mathbb{Z}$.
The homomorphism $\phi: \mathbb{Z}_n \to \mathbb{Z}_k$ is defined as $x \mapsto [x]_k$. To show that it is well defined, you need to show that $\phi(a)=\phi(b)$ whenever $a,b$ are congruent ${\rm mod} n$. To show that it is a homomorphism, you need to show that $\phi(0)=0$, and that $\phi(x+y)=\phi(x)+\phi(y)$.
Now, the key hypothesis is that $k$ divides $n$: write $n=kj$ for some $j \in \mathbb{Z}$. Then: $$x+an = x+ajk = x+bk$$
so in particular if you take any $y \in [x]_n$ then $y \in [x]_k$ as well, which shows that $\phi$ does not depend on the representative that you choose in $[x]_n$ (in other words: it is well defined).
Now: $$\phi(x+y) = [x+an+y+bn]_k = [x+y]_k$$ and $$\phi(x)+\phi(y) = [x+an]_k + [y+bn]_k = [x]_k + [y]_k = [x+y]_k$$