Using numbers
24$\div$2 = 12, 12+3 and 12$-$3 are 6 apart and add up to 24
(or use pairs of numbers that add up to 24)
15 girls and 9 boys
Ratio 15:9 = 5:3
Using algebra
There are $g$ girls and $b$ boys:
$$g+b=24\\ \hspace{1mm} \\g=b+6\Rightarrow g-b=6$$
Adding the two equations gives $$2g = 30$$ So $g=15$, $b=9$ and $g:b=15:9=5:3$