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 xyz,0≤x,y,z≤9.
The number in which 5% occurs exactly once =(3C1)9×9=243
The number in which 5 occurs exactly twice =(3C2⋅9)=27
The number in which 5 occurs in all three digits =1.
Hence, the number of times 5 occurs =1×243+2×27+3×1 =300