Proposition. Let $X$ be a nonsingular projective surface over an algebraically closed field. Let $D$ be an effective divisor on $X$ and let $p_a(D) = 1 - \chi(\mathscr{O}_D)$ be its arithmetic genus, where $\chi(\mathscr{O}_D)$ is the Euler characteristic. Then $2p_a-2 = D.(D+K)$.
Proof. Since $D$ is an effective divisor, we have a short exact sequence $$0 \rightarrow \mathscr{L}(-D) \rightarrow \mathscr{O}_X \rightarrow \mathscr{O}_D \rightarrow 0.$$ Since the Euler characteristic is additive on short exact sequences, we have $$\chi(\mathscr{L}(-D)) = \chi(\mathscr{O}_X) - \chi(\mathscr{O}_D).$$ On the other hand, the Riemann-Roch Theorem for surfaces (e.g., Theorem V.1.6 in Hartshorne) states that for any divisor $E$ on $X$ we have $$ \chi(\mathscr{L}(E)) = \frac{1}{2} E.(E-K) +1 + p_a(X),$$ where $K$ is the canonical divisor on $X$. Now apply this with $E=-D$.
Remark. This is Exercise V.1.3 in Hartshorne. It is also interesting to note that the adjunction formula for nonsingular curves (Proposition V.1.5 in Hartshorne) is used in the proof of the Riemman-Roch Theorem.