Since, $5$ does not occur in $1000$ , we have to count the number of times $5$ occurs when we list the integers from $1$ to $999 $.
Any number between $1 $ and $999$ is of the form $x y z, 0 \leq x, y, z \leq 9$.
The number in which $5\% $ occurs exactly once $=\left({ }^{3} C_{1}\right) 9 \times 9=243$
The number in which $5$ occurs exactly twice $=\left({ }^{3} C_{2} \cdot 9\right)=27$
The number in which $5$ occurs in all three digits $=1$.
Hence, the number of times $5 $ occurs $=1 \times 243+2 \times 27+3 \times 1$
$=300$