Is there a special name for the class of (commutative) rings in which every nonunit is a zero divisor? The main example is $\mathbf{Z}/(n)$. Are there other natural or interesting examples?

A commutative ring $A$ has the property that every nonunit is a zero divisor if and only if the canonical map $A \to T(A)$ is an isomorphism, where $T(A)$ denotes the total ring of fractions of $A$. Also, every $T(A)$ has this property. Thus probably there will be no special terminology except "total rings of fractions". Artinian rings provide examples: If $x \in A$, the chain $... \subseteq (x^2) \subseteq (x) \subseteq A$ is stationary, say $x^k = y x^{k+1}$ for some minimal $k \geq 0$. If $k=0$, $x$ is a unit. If $k \geq 1$, $x (x^k y  x^{k1})=0$ and $x^{k1} \neq y x^k$, i.e. $x$ is a zero divisor. The class of total rings of fractions is closed under (infinite) products and directed unions. Is it the smallest such class containing the artinian rings? 


Any (commutative unitary) ring of Krull dimension 0 has this property. This includes the class of Artinian rings. [Edit] Proof: If $A$ has Krull dimension $0$, then any maximal $m$ ideal of $A$ is also a minimal prime ideal by the definition of Krull dimension. Applying Krull's theorem on the intersection of prime ideals to the localization $A_m$, we find that $mA_m$ is the nilradical of $A_m$. So for any $f\in m$, there exists a positive integer $n$ such that $f^n=0$ in $A_m$. So there exists $s\in A\setminus m$ such that $sf^n=0$ in $A$. We can choose $n$ smallest with respect to this property so that $sf^{n1}\ne 0$. Therefore $f$ is a zero divisor. Now any nonunit element $f$ belong to some maximal ideal, it is a zero divisor. Artining rings are zerodimensional and semilocal. Boolean rings are reduced and zerodimensional. If $(A, m)$ is a local ring, then it has this property if and only if $\mathrm{depth}(A)=0$ (e.g. the example in Daniel Erman's comment). If $A$ is not necessarily local but all localizations $A_m$ at maximal ideals of $A$ have depth $0$, then $A$ has your property. But I don't think this is a necessary condition. [Edit] Similarly one can construct local rings of depth 0 of any (even infinite) dimension. But I don't know whether there exists a ring of positive dimension with infinitely many maximal ideals and such that all its localizations at maximal ideals have depth 0. 


Pace Chris Leary, the standard terminology is that a module all monomorphisms of which are automorphisms is said to be cohopfian (or coHopfian, if you're checking MathSciNet). A Dedekindfinite (a.k.a. directly finite) module usually means a module whose left invertible endomorphisms are also right invertible, equivalently, a module that is not isomorphic to any proper direct summand of itself. T. Y. Lam, in his book Lectures on Modules and Rings, pp. 320–322, calls a noncommutative ring in which every regular element (i.e. neither right nor left zerodivisor) is a unit a classical ring, and he provides various examples. One that has not already been mentioned here is that any right (or left) selfinjective ring is classical. Right selfinjective rings need not have the property that every element that is merely not a left zerodivisor is a unit; interestingly, for right selfinjective rings the latter condition is equivalent to the ring being Dedekindfinite (in the sense of the preceding paragraph), and also equivalent to the ring having stable range 1 (see Y. Suzuki, “On automorphisms of an injective module,” Proc. Japan Acad. 44 (1968), 120–124, and G. F. Birkenmeier, “On the cancellation of quasiinjective modules,” Comm. Algebra 4 (1976), no. 2, 101–109). 


From a more positive perspective, you are looking at rings with the property that every regular element is a unit. I have done some work with these rings. If the ring is commutative, the condition is equivalent to the ring being a quoring, i.e., it's its own classical ring of quotients. Noncommutative rings with the property must be quorings, but the converse is not necessarily true, as seen with von Neumann regular rings. I called rings with every regular element a unit Dedekind finite because they are characterized as Rmodules by the property that every monic endomorphism is an isomorphism (the Dedekind definition of finite set; I picked up the name from L. N. Stout). This is not standard terminology I believe (see Lam's book "Lectures on Modules and Rings). 


I don't know the name for this class of commutative rings. Two quick examples: 1) Any finite ring: then for all $x$ there exist $0 < k < l$ such that $x^k = x^l$, so $x^k(x^{lk}1) = 0$. This shows that $x$ is a zero divisor unless $x^{lk}1 = 0$, i.e., $x^{lk} = 1$, in which case $x$ is a unit. 2) Any Boolean ring, i.e., each element is an idempotent: if $x^2 = x$, then $x(1x) = 0$. Added: Charles Staats's comment gives another important class of rings satifying the desired condition. To flesh it out, first note that the OP's class of rings includes 3) Any local Artinian ring: each nonunit is a member of the unique maximal ideal, which is nilpotent (e.g. Theorem 82 of http://math.uga.edu/~pete/integral.pdf). Also 4) The OP's class is closed under finite products. Indeed, let $R = R_1 \times \ldots \times R_n$, where the $R_i$ are in the OP's class. Let $x = (x_1,\ldots,x_n)$ be a nonunit of $R$. This happens iff for at least one $i$, $x_i$ is a nonunit in $R_i$. Without loss of generality say $i = 1$. Then there exists a nonzero $y_1$ in $R_1$ such that $x_1 y_1 = 0$. Putting $y = (y_1,0,\ldots,0)$, we get $xy = 0$. It follows that any finite product of local Artinian rings is in the OP's class. But every Artinian ring is a finite product of local Artinian rings (e.g. Theorem 86 of http://math.uga.edu/~pete/integral.pdf), so every Artinian ring is in the OP's class. 


I have studied a noncommutative version of this. There is such a thing called a right cohopfian ring in the sense that if the right annihilator of r is zero, then r is a unit. If you add commutativity and look at the contrapositive, you get that nonunits are zero divisors. I don't think this terminology has caught on, but here is the rationale. A "cohopfian object" is one for which injections are surjections. Looking on elements of the ring as maps sending x>rx, we are saying that if such a map is injective, it is surjective. Right Artinian, right perfect and stronglypi regular rings (commutative VNR rings are strongly pi regular) are all right and left cohopfian. Finding a onesided cohopfian ring seems tough, but Varadarajan did it here: "Varadarajan, K. Hopfian and coHopfian objects. Publ. Mat. 36 (1992), no. 1, 293–317." I think someone has noted above that right cohopfian rings have ot be Dedekind finite, and it is interesting that Dedekind finite=right Hopfian=left Hopfian. Too bad I didn't see this a year ago :) 


As Greg Marks says, there is a natural generalisation of this property to a noncommutative ring $R$: "Every regular element (= neither left nor right zerodivisor) in $R$ is a unit", which is equivalent to "The set of regular elements in $R$ is (left and right) Ore, and the natural localisation morphism is an isomorphism". This has been called "full quotient ring" or the like, now Lam calls it "classical". Since I have not found it in any comment or answer here as yet (and neither in Lam's book), let me add that (twosided) Noetherian rings of this form have been investigated in J. T. Stafford: Noetherian Full Quotient Rings (Proc. London Math. Soc. (3) 44 (1982) pp. 385404). Quote:
In the commutative case, the criterion is simply $ann (A(R)) \subseteq J(R)$, and "semilocal" equals "finitely many maximal ideals". Without the "Noetherian" assumption, the criterion does not make sense as $A(R)$ may not exist, and its corollary is false in general. Ad: I have asked if this property is Morita invariant in MO 124856. 


I don't know whether this concept has been named. But other examples include Boolean rings and products of endomorphism (matrix) algebras, and rings such as $\mathbb{C}[x]/(x^2)$, or more generally the total algebra of a graded algebra which is bounded in degree, as for example, the cohomology algebra of a space homotopy equivalent to a finite CW complex (with coefficients in a field). Edit: Sorry, I meant a connected graded algebra (where the degree 0 part is the field of coefficients). 


How about calling these things balanced commutative rings? Recall that a category satisfying "monic + epic > isomorphism" is said to be balanced. Therefore, it makes sense to call a monoid balanced iff every element that is both leftcancellative and rightcancellative is a unit. Therefore, it makes sense to call a ring balanced iff every element that is neither a left zerodivisor nor a rightzero divisor is a unit. Therefore, it makes sense to call a commutative ring balanced iff every nonzero divisor is a unit. 


I think if you have some information about rings of continuous functions $C(X)$, you can construct a wide class of rings with this property. At first let me give you some special information about these examples. Def 1. For topological space $X$ we denote the ring of all continuous functions on $X$ by $C(X)$. for $f\in C(X)$ the zeroset of $f$ is defined as: $Z(f)=${$x\in X$: $f(x)=0$} Def 2. A completely regular topological space $X$ is called an almost $P$space, if for every $f\in C(X)$ with nonempty zeroset, i.e. $Z(f)$, this set has nonempty interior, i.e. there exist $x$ that $x\in int_X Z(f)$. With the above definition, I can introduce a theorem which classifies all Rings of continuous functions $C(X)$ with the property that every nonunit is a zerodivisor. Theorem: In the ring $C(X)$, every nonunit is a zero divisor iff the topological space $X$ is almost $P$space. The simplest examples of almost $P$spaces are discrete spaces. for example if $X$ is a discrete space, then $C(X)$ is equal to the usual cartesian product $\mathbb{R}^X$. So for arbitrary set $X$ you can construct $\mathbb{R}^X$ to have the property of your question. 

