Assuming you mean in the numbers 1, 2, 3, ..., 998, 999, 1000 then the digit 0. (The digit 1 appears 301 times, the digits 2-9 all appear 300 times each, but the digit 0 only appears 192 times.)
1-301 times
300
All the numbers between 999 and 3000 are four-digit numbers. You need to subtract 3000 - 999 - 1. The extra -1 is to account for the fact that the numbers 999 and 3000, in this case, are not included.
The sum 9 + 99 + 999 + 9999 + 99 999 + .... where the last number to be added consists of nine digits of 9 becomes: (10 – 1) + (100 – 1) + (1000 – 1) + (10 000 – 1) + ... where the last multiple of 10 has nine zeros. There are nine pairs of brackets altogether. Add the multiples of 10 first and then subtract 9: The digit 1 appears 9 times in the final answer.
By including the number 1000, the digit 1.
Assuming you mean in the numbers 1, 2, 3, ..., 998, 999, 1000 then the digit 0. (The digit 1 appears 301 times, the digits 2-9 all appear 300 times each, but the digit 0 only appears 192 times.)
9
1-301 times
The digit 9 appears in the units place 100 times from 1 to 1000 (9, 19, 29,..., 989, 999). It also appears in the tens place 100 times (90, 91, 92,..., 99, 190, 191,..., 199, 290,..., 999). Therefore, the digit 9 appears a total of 200 times from 1 to 1000.
The digit appears eleven time from 1 to 100.
There are 900 three-digit whole numbers between 1 and 1000
1
How many times does the digit 1 occur in ten place in the numbers from 1 to 1000?
There are 200 positive four digit integers that have 1 as their first digit and 2 or 5 as their last digit. There are 9000 positive four digit numbers, 1000 through 9999. 1000 of them have 1 as the first digit, 1000 through 1999. 200 of them have 2 or 5 as their last digit, 1002, 1005, 1012, 1015, ... 1992, and 1995.
#include<iostream> #include<array> #include<sstream> std::array<int,10> get_frequency (int range_min, int range_max) { if (range_max<range_min) std::swap (range_min, range_max); std::array<int,10> digit {}; for (int count {range_min}; count<=range_max; ++count) { std::stringstream ss {}; ss << count; std::string s {}; ss >> s; for (auto c : s) { ++digit[c-'0']; } } return digit; } int main () { std::array<int,10> digit {}; digit = get_frequency(1, 89); std::cout << "In the range 1 to 89...\n"; for (int d {0}; d<10; ++d) { std::cout << "\tthe digit " << d << " appears " << digit[d] << " times.\n"; } } Output: In the range 1 to 89... the digit 0 appears 8 times. the digit 1 appears 19 times. the digit 2 appears 19 times. the digit 3 appears 19 times. the digit 4 appears 19 times. the digit 5 appears 19 times. the digit 6 appears 19 times. the digit 7 appears 19 times. the digit 8 appears 19 times. the digit 9 appears 9 times.
Predecessor of a number is obtained by subtracting 1 from it. The smallest 4 digit number is 1000 and its predecessor is 1000 - 1 = 999.