A non-zero number $a \in \mathbb Z_n$ is called a divisor of zero if there is a non-zero number $b \in \mathbb Z_n$ such that $ab\equiv 0\pmod n.$
How can I prove $\mathbb Z_n$ has divisors of zero if and only if $n$ is not prime.
I filled out the addition and multiplication tables for modulo 6 and 7 and tried to find out the relation, and it's definitely true. I know I need to prove it in both directions since it is an 'iff' question. But I still don't get it.