You can write two equations and solve a system of equations.
Let b = number of boys.
Let g = number of girls.
There are 40 students, so our first equation is:
b + g = 40
Each boy collected 80 kg, so all boys combined collected 80b.
Each girl collected 45 kg, so all girls combined collected 45g.
The total collected by all the students is 80b + 45g.
We are told the total collected was 2640 kg, so our second equation is:
80b + 45g = 2640
We have the system of equations
b + g = 40
80b + 45g = 2640
We will now solve it by the substitution method.
Solve the first equation for b:
b = 40 - g
Now substitute b with 40 - g in the second equation.
80b + 45g = 2640
80(40 - g) + 45g = 2640
3200 - 80g + 45g = 2640
3200 - 35g = 2640
-35g = -560
g = 16
Now we substitute g = 16 in the first original equation to find b.
b + g = 40
b + 16 = 40
b = 24
From our system of equations, we get that there are 24 boys and 16 girls.
Now we check the answer.
24 boys collect 24 * 80 kg = 1920 kg
16 girls collect 16 * 45 kg = 720 kg
All 40 students collect 1920 kg + 720 kg = 2640 kg.
2640 kg is indeed the number given to us by the problem, so our answer is correct.
Answer: There are 24 boys and 16 girls.