The smallest 8 digit number is 10,000,000; the largest is 99,000,000.
If you write all of them: 10,000,000 and 10,000,001 and 10,000,002, etc., you will have an arithmetic sequence (you can always get the next one by adding 1 to the previous one).
The formula for the sum of an arithmetic sequence is: Sum = n(f + l)/2
where n = number of terms = 89,000,001,
f = first term = 10,000,000
and l = last term = 99,000,000
So, the sum of all the 8 digit numbers is: 89 000 001(10 000 000 + 99 000 000) / 2
Similarly, for 10 digit numbers.