Let $Y\subset\mathbb{P}^n$ be a smooth variety of codimension two. Consider the blow-up $X = Bl\_Y\mathbb{P}^n$ of $\mathbb{P}^n$ along $Y$, and let $E$ be the exceptional divisor over $Y$. Then $E$ has a structure of $\mathbb{P}^1$-bundle over $Y$. The anticanonical divisor is 
$$-K\_X = (n+1)H-E.$$
I would like to compute $(-K\_X)^n$. For example if $Y\subset\mathbb{P}^3$ is a curve of degree $d$ and genus $g$, by Shafarevich "Algebraic Geometry V" Lemma 2.2.14, we have:
$$E^3 = -deg(N\_{Y/\mathbb{P}^3}) = K\_{\mathbb{P}^3}\cdot C-2g+2 =-4d-2g+2.$$
and
$$(-K\_X)^3 = 62+2g-8d.$$
I would like to have a formula for the top self-intersection $(-K\_X)^n$ when $X$ is the blow-up of a smooth subvariety $Y\subset\mathbb{P}^n$ of codimension two. Even for complete intersections of two hypersurfaces it would be good. More generally does there exists a formula for $(-K\_X)^n$ when $X$ is the blow-up of $\mathbb{P}^n$ along a smooth subvariety of codimension $c$ (again, I would be happy with complete intersections)?



Top self-intersection of exceptional divisors
So you want to compute the intersection numbers $(H^p\cdot E^q)$, $p+q=n$.


Let me start with some notation. Let $b: X\rightarrow \mathbb{P}^n$ be the blowing up, $i:E \hookrightarrow X$ the embedding, $p:E\rightarrow Y$ the projection. Write one factor $E$ as $i\_\*1$ (in $CH(X)$, say) and use the projection formula twice:
$$(H^p\cdot E^q)=(i^\*E^{q-1}\cdot p^\*H\_Y^p)=(p\_\*i^\*E^{q-1}\cdot H\_Y^p)\quad \mbox{where }\ H\_Y:=c\_1(\mathcal{O}\_{\mathbb{P}^n}(1))\_{|Y}\ .$$ We have $i^\*E=-h$, where $h$ is the first Chern class of the tautological line bundle $\mathcal{O}\_E(1)$ on $E=\mathbb{P}(N^\*\_{Y/\mathbb{P}^n})$. The classes $s\_m:=p\_\*h^{m+c-1}$ (with $c=\mathrm{codim}(Y)$) are the *Segre classes* of $N\_{Y/\mathbb{P}^n}$; they are easily calculated from the Chern classes, see Fulton Intersection Theory, Chapter 3. So the numbers $(H^p\cdot E^q)=(-1)^{q-1}s\_{q-c}\cdot H\_Y^p$ can be calculated when you know the Chern classes of the normal bundle. In codimension 2 you just have two nonzero Chern classes, so the computation is relatively easy. For instance, if $n=3$ and $Y$ is a curve of degree $d$ and genus $g$, you find $(-K\_X^3)= 64-8d+2g-2$. 


