This is an exercise in a book "Rings and Modules- Musili": (in this book, ring may not have unity.)
Give an example of a non-trivial commutative ring in which square of every element is zero.
Here non-trivial means it is not the case that "$xy=0$ for all $x,y$".
This also raises a natural question:
Give an example of a non-trivial non-commutative ring in which square of every element is zero.
I tried the following examples: $\mathbb{Z}/2\mathbb{Z}\times \mathbb{Z}/2\mathbb{Z}\times\mathbb{Z}/2\mathbb{Z}$, with point-wise addition and multiplication like well known "cross product" in vector calculus in $\mathbb{R}^3$. But, this product is not associative.
Another example, $M_2(\mathbb{Z}/2\mathbb{Z})$ with usual addition; but multiplication $*$ defined as $A*B=AB+BA$. But here also, associativity of $*$ fails.
Best Answer
Start with $\mathbb{Z}_2$ and its two-variable polynomial ring $\mathbb{Z}_2[x,y]$. Introduce the relations $x^2=y^2=0$ and take the subring $R$ generated by $x$ and $y$. Everything squares to zero, since in characteristic $2$ $(a+b)^2=a^2+b^2$ and every element of $R$ is a sum of terms divisible by either $x$ or $y$. However, $xy\neq 0$.