$1$: All ring homomorphisms from $\mathbb{Z}$ to $\mathbb{Z}$
Let $f: \mathbb{Z} \to \mathbb{Z} $ be a ring homomorphism. Note that for $n \in \mathbb{Z}$,
$f(n) = nf(1)$.
Thus $f$ is completely determined by its value on $1$.
Since $1$ is an idempotent in $\mathbb{Z} $ (i.e. $1^2 = 1$), then $f(1)$
is again idempotent.
Now we need to determine all of the idempotents of $\mathbb{Z} $. To this end, take $x\in \mathbb{Z}$ such that
$x^2 = x$. Thus $x^2 − x = x(x − 1) = 0$. Since $\mathbb{Z} $ is an integral domain, we deduce that either $x = 0$ or $x = 1$. Thus the
complete list of idempotents of $\mathbb{Z} $ are $0$ and $1$. Thus $f(1)$ being idempotent implies that either $f(1) = 0$ or $f(1) = 1$. In the
first case, $f(n) = 0$ for all $n$ and in the second case $f(n) = n$ for all $n$. Thus,
the only ring homomorphisms from $\mathbb{Z} $ to $\mathbb{Z} $ are the zero map and the identity map.
$2$: All ring homomorphisms from $\mathbb{Z}$ to $\mathbb{Z}\times \mathbb{Z}$
Let $f$ be such a ring homomorphism. Suppose that
$f(1) = (a, b) $, with $a, b \in \mathbb{Z} $. Since $f$ is a ring homomorphism it follows that In particular,
$f(m) = f(m · 1) = m · f(1) = m(a, b)$ (follows from the additivity of $f$). On the other hand, $f$ preserves multiplication. That is, $f(mn) = f(m)f(n)$. Thus, we
have
$mn(a, b) = m(a, b) · n(a, b)$ iff
$mn(a, b) = mn(a^2, b^2)$ iff
$(a, b) = (a^2, b^2)$ if $mn\neq 0$.
This last inequality only holds if $a = 0, 1$ and $b = 0, 1$. It follows that there are four
ring homomorphisms which are given by
$f_1(1) = (0, 0)$,
$f_2(1) = (1, 0)$,
$f_3(1) = (0, 1)$,
$f_4(1) = (1, 1)$.
More explicitly, these are
$f_1(m) = (0, 0)$,
$f_2(m) = (m, 0)$,
$f_3(m) = (0,m)$,
$f_4 (m) = (m,m)$.
$3$: All ring homomorphisms from $\mathbb{Z}\times \mathbb{Z}$ to $\mathbb{Z}$
Since $\mathbb{Z}\times \mathbb{Z}$ is generated by $(1, 0)$ and $(0, 1)$, it suffices to find to find $f(1, 0)$ and $f(0, 1)$
Leaving this for you.
$4$: All ring homomorphisms from $\mathbb{Z}\times \mathbb{Z}\times \mathbb{Z}$ to $\mathbb{Z}$
Hint. Find $f(1, 0, 0)$ $f(0, 1, 0)$
and $f(0, 0,1)$