TITLE: A finite commutative ring with the property that every element can be written as product of two elements is unital
QUESTION [14 upvotes]: I was struggling  for days with this nice problem:

Let  $A$  be  a finite commutative  ring such that every element of $A$  can be written as product of two elements of $A$. Show that $A$  has a multiplicative unit  element.

I need a hint for this problem, thank you very much.

REPLY [5 votes]: HINT $\ $ The hypothesis implies that $\rm\:A^2 = A\:.\:$ Therefore, by invoking the simple Lemma in this answer, we deduce that $\rm\:A\:$ is principal, generated by an idempotent.
NOTE $\ $ The cited Lemma is a generalization of the proof hinted by Jonas (and Pierre). As here, this Lemma often proves handy so it is well-worth knowing.