If $X$ is a smooth variety over the complex numbers, you can use the topological Euler characteristic of the support $X(\mathbb{C})$ of the scheme. The most efficient way to compute it is to use Chern classes and the Poincaré-Hopf theorem: the Euler characteristic is the degree of the top Chern class. Chern classes can be defined purely algebraically (in homology) as it is done for example in Chapter 3 of Fulton's book "Intersection Theory".
When $X$ is singular, there are many nonequivalent generalizations of the Euler characteristic. One efficient approach is again to work in the spirit of the Poincaré-Hopf theorem by first defining Chern classes for singular varieties. This provides a purely algebraic treatment. I will give a tour of the 4 most famous examples:
-The Chern-MacPherson class (also known as the Chern-Schwartz-MacPherson class ) is probably the most important. It can be defined on the Chow group of a variety using constructible functions. It enjoys beautiful functorial properties under proper maps and it is compatible with specializations. The existence of the Chern-MacPherson class realizes a conjecture of Deligne and Grothendieck of 1969 as the unique natural transformation between the covariant functor of constructible functions and the usual covariant functor of $\mathbb{Z}$-homology such that it maps the characteristic function of a manifold to its (homological) Chern class. The Chern-MacPherson class computes the topological Euler characteristic of a (possibly singular) variety.
-The Chern-Mather-class enters the definition of the Chern-MacPherson class. It is relevant to compute stringy invariants. It has nice properties under proper birational maps and can be simply defined using a Nash-blow-up.
These two classes (MacPherson and Mather) can be generalized to scheme by considering the support of the scheme. This makes calculations much more easy, but obviously one looses a lot of the information carried by the scheme. The next two definitions are much more "scheme friendly" but they have less understood functorial properties.
-The Chern-Fulton and the Chern-Fulton-Johnson classes are both extremely sensitive to the scheme structure. They coincide in the case of local proper intersections. In general they don't satisfy the "inclusion-exclusion principle" which is satisfies by the topological Euler characteristic.
References
For a friendly introduction with references to the appropriate literature, I would recommend this short lecture notes by Paolo Aluffi.
The general treatment is discussed in Fulton's book Intersection Theory (specially section s 4.2.6, 4.2.9 and 19.1.7). For applications to motivic integration and stringy invariants see for example
this review or this one.
As an alternative to R. Budney's answer, one might also notice that the Gauss-Bonnet formula (the one you mention - mind that you must assume that $X$ is projective, otherwise the integral might not even make sense) is a consequence of the Hirzebruch-Riemann-Roch theorem. Indeed, the HRR theorem says
$$
\chi(V)=\int_{X}{\rm Td}({\rm T}X){\rm ch}(V)
$$
where $$\chi(V):=\sum_{l}{(-1)}^l{\rm rk}(H^l(X,V))$$ is the Euler characteristic of coherent sheaves. Now there is an universal identity of Chern classes
$$
{\rm ch}(\sum_{r}(-1)^r\Omega_X^r){\rm Td}(\Omega^\vee_X)=c^{\rm top}(\Omega^\vee_X)
$$
(called the Borel-Serre identity). Here $\Omega_X$ is the sheaf of differential of $X$ and thus $\Omega^\vee_X={\rm T}X$. Plugging the element $\sum_{r}(-1)^r\Omega_{X}^r$ into the HRR theorem, one gets
$$
\sum_{k,l}(-1)^{l+k}{\rm rk}(H^k(X,\Omega^l))=\int_{X}c^{\rm top}(TX)
$$
and by the Hodge decomposition theorem
$$
\sum_{k,l}(-1)^{l+k}{\rm rk}(H^k(X,\Omega^l))=\sum_{r}{(-1)}^r{\rm rk}(H^r(X({\bf C}),{\bf C}))
$$
where $H^r(X({\bf C}),{\bf C})$ is the $r$-th singular cohomology group.
The quantity $\sum_{r}{(-1)}^r{\rm rk}(H^r(X({\bf C}),{\bf C}))$ is the topological Euler characteristic, so this proves what you want.
The HRR theorem is proved in chap. 15 of Fulton's book (or in Hirzebruch's book "Topological methods...") and the Borel-Serre identity is Ex. 3.2.5, p. 57 of the same book.
Best Answer
The same thing is true in positive characteristic, the degree of $c_n$ is equal to the Euler characteristic (except if you consider de Rham cohomology where it only is the Euler characteristic mod $p$). The proof of course cannot use the standard proof in the complex case, using Hopf's theorem that says that the degree of the Euler class is the Euler characteristic and the identification of the Euler class with the top Chern class). One can instead use the Riemann-Roch theorem and the identification of the Euler characteristic with the de Rham Euler characteristic. Given the latter the rest is just to verify that the seemingly complicated expresssion of the Riemann-Roch simplifies by a calculation using the splitting principle to just $c_n$. Alternatively, if I remember correctly one can use a Lefschetz pencil and induction over the dimension.
Addendum: It's all coming back to me, a third possibility is to use that the self-intersection of the diagonal is on the one hand the Euler characteristic (as it is gives the trace of the identitity map), on the other hand that self-intersection is given by the top Chern class of the normal bundle of the diagonal which is exactly the cotangent bundle.