The average age of all the students of a class is 18 years, The average age of boys of the class is 20 years and that of the girls is 15 years. If the number of girls in the class is 20, then what is the number of boys in the class?
Let total number of boys in the class = B
Now,
Average age of the class = $$18 = \frac{20 * B + 15 * 20}{B + 20}$$
18(B + 20) = 20B + 300
18B + 360 = 20B + 300
2B = 60
B = 30