Let $R$ a ring (with $1\in R$). I want to show that $R$ is a field $\iff$ it has exactly two ideals.
For $\implies $ it's obvious. Indeed, if $R$ is a field and $I\neq \{0\}$ an ideal, then, $I=A$ since $$x\in I\implies xx^{-1}\in I$$ and thus $1\in I$. In particular, if $x\in A$, then $x\cdot 1\in I$ and thus $x\in I$.
For the converse I don't really know how to do. My idea was the following one:
I show that if $R$ is not a field then it has more that two ideals. Indeed, let $R$ be not a field. Then, there is $x\in R$ that has no inverse. In particular, $(x)\notin \{R,\{0\}\}$. Indeed, if $(x)=(0)$ then $x=0$ which is a contradiction. If $(x)=R$, then $1\in (x)$ and thus there is $n$ s.t. $x^n=1$ what prove that $x$ is invertible and is also a contradiction.
Is it correct ? Is there a more direct proof ? i.e. like this:
Let $A$ and $\{0\}$ the two ideal of $R$. How can I show that all element of $A\backslash \{0\}$ are invertible ? By contradiction, if not, the $$xy\neq 1$$ for all $y\in R$. Therefore, $(x)$ doesn't contain $1$, and thus, $R$ has at least three ideal, which is a contradiction.
Is it correct ?