Give an example of a UFD having a subring which is not a UFD.

Take any integral domain which is not a UFD and consider it as a subring of its field of fractions. (Fields are UFD for trivial reasons and if you don't accept this, take the polynomial ring over it)


Consider $\mathbb C$ , it is a field hence obviously $UFD $ but if you consider a subring $\mathbb Z[\sqrt {-5}]$, it is not a UFD . In fact, $9=3.3$ and also $9= (2+\sqrt{-5} ) . (2-\sqrt{-5})$ , Hence the factorization is not unique.


One question to ask after reviewing the two answers already posted is whether the existence of an extension $S\subset R$, with $R$ a UFD and the nonunits of $S$ being nonunits in $R$, makes $S$ a UFD.

While plausible, this is also false. For instance $k[x^2,x^3]\subset k[x]$ is a counterexample for any UFD $k$. This is because $x^2$ and $x^3$ are irreducible and yet $x^6=(x^2)^3=(x^3)^2$.