Total number of students in the class = 40
and out of 40 students, number divisible would be:
Case : Number divisible by 3 or Sum of its digits divisible by 3
Total 3-digit numbers = 100 to 999 = 900 numbers
First number divisible is greater than 100, i.e., = 102
Now add 3 to 102 till 999
a = 102
Common difference d = 3
n = ?
Last number = 999
=> 999 = a + (n - 1)d
=> 999 = 102 + (n - 1)3
=> 897/3 = n - 1
, n = 300
Probability = 300/900 = 1/3