Example of a ring in which square of every element is zero 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.
 A: 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$.
A: Long comment...
Suppose here exists such a ring $R$. Since it is not commutative, there are two elements $x$ and $y$ in $R$ which do not commute. Consider the ring $F$ which is free as a $\mathbb Z$-module with basis the set of (positive length) words in two letters $a$ and $b$. There is then a ring morphism $f:F\to R$ mapping $a$ and $b$ to $x$ and $y$, repectively. It follows from this that kernel $I=\ker f$ is an ideal of $F$, and it must contain all squares of elements of $F$.
This suggests that we consider precisely the ring $U=F/Q$ with $Q$ the ideal generated by all squares. Indeed, the argument above implies that if there is any example at all of what you are looking for, then $U$ is also an example, so we may just as well consider $U$ as an example! Of course, we have to check that $U$ is an example. In $U$ every square is zero by construction, but wee have to check that it is non-commutative (it could fail to be non-commutative, if for example it turns out that $Q=F$.
...and an example
Now $x^2$ and $y^2$ are in the ideal $Q$, so $Q$ contains the whole ideal $(x^2,y^2)$. This implies that $U$ is a quotient of the algebra $\mathbb\langle x,y\rangle/(x^2,y^2)$. This has as a basis the monomials of positive length which alternate $x$s and $y$s. This means that these monomials also span $U$. But in $U$ $x$ and $y$ anticommute, as hardmath observed. This allows us to see exactly what $U$ is: it is the free abelian group with basis $x$, $y$ and $xy$, with product such that every square is zero and $x$ and $y$ anticommute.
Once we have gotten us this example, we can think how to obtain it all in one swoop. That's easy: let $V=\mathbb Z^2$ be a free abelian group of rank two, let $E=\Lambda V$ be the exterior algebra of $V$, and let $A\subseteq E$ be its augmentation ideal. Then $A$ is isomorphic to the universal example $U$ we constructed above.
