There are 100 integers from 0 to 99, inclusive.
Considering 0 to have no digits, the sum of all integers with none, 1 or 2
digits is
Put a 0 on the end of each, and you've multiplied each by 10, and now the sum
of those 100 is 10 times as much, or 49500, and each of those 100 now ends
with 0.
Add 3 to each of those 100, and you've added 300 to the 49500 sum, so there are
49500+300=40800 that end with 3.
Add 4 to each of those 100, and you've added 400 to the 49500 sum, so there are
49500+400=40900 that end with 4.
Add 5 to each of those 100, and you've added 500 to the 49500 sum, so there are
49500+500=50000 that end with 5.
Add 8 to each of those 100, and you've added 800 to the 49500 sum, so there are
49500+800=50300 that end with 8.
Total = 49800+49900+50000+50300 = 200000
Edwin
I'm going to do more work than the problem requires, to make sure I'm doing
it correctly, and hopefully this method helps you gain some intuition.
Sum of all positive integers less than 1000 ending in 0:
Sum(0+10n; n=0,...,99) = 0*sum(0, n=0,...,99) + 10*sum(0...99) = 10*(99*100/2)
= 0 + 49500 = 49500
Sum of all positive integers less than 1000 ending in 1:
Sum(1+10n; n=0,...,99) = 1*sum(1, n=0,...,99) + sum(10n, n=0,...,99)
= 100 + 49500 = 49600
Repeating the above two calculations and noting we just add 100 for each
higher digit:
Sum of all positive integers less than 1000 ending in 0: 49500
Sum of all positive integers less than 1000 ending in 1: 49600
Sum of all positive integers less than 1000 ending in 2: 49700
Sum of all positive integers less than 1000 ending in 3: 49800 (#)
Sum of all positive integers less than 1000 ending in 4: 49900 (#)
Sum of all positive integers less than 1000 ending in 5: 50000 (#)
Sum of all positive integers less than 1000 ending in 6: 50100
Sum of all positive integers less than 1000 ending in 7: 50200
Sum of all positive integers less than 1000 ending in 8: 50300 (#)
Sum of all positive integers less than 1000 ending in 9: 50400
total: 499500
Sanity check the above total, which should be the same as ALL numbers 0...999:
Sum(n; n=0,...,999) = 999*1000/2 = 499500
Sum the rows with (#), you should get 200000