Number of nine digits numbers whose sum of the digits is even I am reading Mathematical Circle. Problem $48$ in chapter two says that 

How many nine-digit numbers have an even sum of their digits?

I am trying in this way, that we can divide the problem in four cases. 


*

*$1$ even digit and $8$ odd digits

*$3$ even digits and $6$ odd digits

*$5$ even digits and $4$ odd digits

*$7$ even digits and $2$ odd digits


For the first case we get $4 \cdot 5^8 +5\cdot 5^7 \cdot 5$ number of solution. Because if the even digit is placed in first place (left to right) then we get $4\cdot 5^8$ ways to write the number and if an odd digit is placed in first place then we get $5\cdot 5^7 \cdot 5$ ways to write the number. Similarly for the second case we get $4\cdot 5^8+5^9$ , for the third case we get $4\cdot 5^8+5^9$ and for the fourth case we get $4\cdot 5^8+5^9$ ways to write the number. So total number is $ 4 \cdot (4\cdot 5^8+5^9)$. 
The answer is different. So Where I have made a mistake?
Thanks.

$9$ digit numbers range from $10^8$ to $10^{9}-1$. There are exactly $9 \cdot 10^8$ numbers, that have nine digits.
$10^8 + 0$ doesn't have an even sum of its digits $(=1)$.
$10^8+1$ has an even sum of its digits $(=2)$.
$10^8+2$ doesn't have an even sum of its digits $(=3)$.
$10^8+3$ has an even sum of its digits $(=4)$.
$10^8+4$ doesn't have an even sum of its digits $(=5)$. 
$10^8+5$ has an even sum of its digits $(=6)$.
$10^8+6$ doesn't have an even sum of its digits $(=7)$. 
$10^8+7$ has an even sum of its digits $(=8)$.
$10^8+8$ doesn't have an even sum of its digits $(=9)$. 
$\vdots  \hspace{3cm}    \vdots \hspace{3cm}    \vdots$ 
$10^9-3$ has an even sum of its digits$(=-2)$.
$10^9-2$ doesn't have an even sum of its digits $(=-1)$. 
$10^9-1$ has an even sum of its digits $(=0)$. 
See the pattern? Here is a C++ Code that finds that out for you:
int main()
{
    unsigned long int x;
    x = 0;
    for(unsigned long int i = 100000000; i <= 1000000000-1; i++)
        if (i % 2 == 0)
            x++;
    std::cout << x;
}

This yields $x = (9 \cdot 10^8)/2 = 45\cdot 10^7$. Half of the numbers with nine digits have an even digit sum.
