Let
x = the number of girls
y = the number of boys
If 25% of the boys left the computer club, the ratio of the number of boys who remained to the number of girls would be 5:8.
(a)What was the ratio of the number of boys to the number of girls in the computer club?
25% = 25/100 = 1/4
So, if 1/4 of the boys left, there would remain 3/4. In mathematical terms the ratio would then be:
(3/4)y / x = 5/8.
But as actually nobody has left, the ratio is:
y / x = (5/8) / (3/4) = 5/6.
___________________
[...] each girl received 4 sweets fewer than each boy. They received 294 more sweets than the girls and a total of 1806 sweets were given out.
And the ultimate question is:
(b) What was the total number of boys and girls in the club?
We'll firstly have to figure out how those sweets were distributed. And we introduce another unknown:
n = number of sweets for each girl.
xn = number of sweets for the girls (in total). And
y(n + 4) = sweets for the boys, as each boy gets 4 sweets more than each girl.
The ratio y:x = 5:6 is now very useful, because it follows immediately:
y = (5/6)x, and
x = (6/5)y, which comes in handy for substitution purposes.
Now we can build our system of two linear equations:
(Note that I have rephrased the 1st condition to: "Each boy gets 4 sweets more than each girl". If you want to do it according to the original text, n would then represent the number of sweets for each boy, and the number of sweets for the subset of girls would then equal x(n - 4).)
(1) y(n + 4) + nx = 1806
The boys received 294 more sweets than the girls, which is just the difference:
(2) y(n + 4) - nx = 294
Resolve parentheses and substitute (6/5)y for x
(1.1) ny + 4y + (6/5)ny = 1806
(2.1) ny + 4y - (6/5)ny = 294
(1.2) (11/5)ny + 4y = 1806
(2.2) -(1/5)ny + 4y = 294 ;; Times 11
(2.3) -(11/5)ny + 44y = 3234
Add equations (1.2) + (2.3)
48y = 5040
y = 105.
There are 105 boys in the club.
As x=(6/5)y, x = 126.
There are 126 girls in the club.
x + y = 231.
The total number of boys and girls in the club is 231.
Btw, each girl gets 6 sweets, and each boy gets 10.