We count the number of 3-digit numbers with (i) at least one 5 and having no 3 and (ii) at least one 5 and having exactly one 3 separately.
(i) Here we rst count the whole set and subtract the number of 3-digit numbers having no 5 from it. Since 3 is not there and 0 cannot be the rst digit, we can ll the rst digit in 8 ways. But we can ll the second and third digits in 9 ways(as 0 can be included). Thus we get 8 x 9 x 9 such numbers. If no 5 is there, then the number of such numbers is 7 x 8 x 8. Thus the number of 3-digit numbers not containing 3 and having at least one 5 is (8 x 9 x 9) - (7 x 8 x 8) = 8(81 - 56) = 200.
(ii) If 3 is there as a digit, then it can be the rst digit or may be the second or third digit. Consider those numbers in which 3 is the rst digit. The number of such numbers having at least one 5 is (9 x 9) - (8 x 8) = 81 - 64 = 17. The number of 3-digit numbers in which the second digit is 3 and having at least one 5 is (8 - 9) - (7 x 8) = 16. Similarly, the number of 3-digit numbers in which the third digit is 3 and having at least one 5 is (8 - 9) - (7 x 8) = 16. Thus we get 17 + 16 + 16 = 49 such numbers.
Therefore the number of 3-digit numbers having at most one 3 and at least one 5 is 200+49 = 249.