How to obtain the cohomology of $\mathbb{CP}^n$ and $\mathbb{RP}^m$, and what are the precise answers:
$$ H^i(\mathbb{CP}^n,\mathbb{Z}_2)=\text{?} $$
$$ H^i(\mathbb{CP}^n,\mathbb{Z} )=\text{?} $$
$$ H^i(\mathbb{RP}^n,\mathbb{Z}_2)=\text{?} $$
$$ H^i(\mathbb{RP}^n,\mathbb{Z} )=\text{?} $$
You can find the cohomology of $\mathbb{CP}^{n}$: https://topospaces.subwiki.org/wiki/Cohomology_of_complex_projective_space
$$ H^p(\mathbb{P}^n(\mathbb{C});M) = \left\lbrace\begin{array}{rl} M, & \qquad p \text{ even, } 0 \le p \le 2n\\ 0, & \qquad \text{otherwise} \end{array}\right. $$
find the cohomology of $\mathbb{RP}^{n}$: https://topospaces.subwiki.org/wiki/Cohomology_of_real_projective_space
$$ H^p(\mathbb{P}^n(\mathbb{R}); M) = \left\lbrace \begin{array}{rl} M, & \qquad p=0,n\\ M/2M, &\qquad p \text{ even, } 0 < p < n\\ T, & \qquad p \text{ odd, } 0 < p < n \\ 0, & \qquad \text{otherwise}\end{array}\right. $$ Here $M$ is an Abelian group.
Here $T$ denotes the $2$-torsion subgroup, i.e., the subgroup comprising elements of order dividing $2.$