5*30 = 150
9*30 = 270
Since the ratio is 5:9 you have to multiply both numbers in the ratio by the same constant.
I just started multiplying by 10, then 20, then 30 until I got numbers that had a difference of 120.
There are 150 boys.
Setting up an equation
5x + 120 = 9x
Solve for x and then multiply the ratio by the x to get the same result.