Answer:
38
Explanation:
It is clear that the number of sweets that should be bought so that each child can get either 8 or 9 sweets should be divisible by both 8 and 9
This is called the LCM or least common multiple of 8 and 9
Since 8 and 9 have no divisors in common LCM of 8 and 9 is 72 so 72 is the minimum number of sweets to buy so that there are no leftovers if each child gets 8 or 9 sweets
Let's compute the number of sweets that were bought the first time. Let the number of children be X
Since each child got 8 sweets and 2 were left over, the total of sweets must be 8X + 2
If each child were to get 9 sweets each then there would be 2 sweets short
This can be written as 9X -2 for the total number of sweets
Since these have to be equal,
9X - 2 = 8X + 2
Add 2 to both sides:
9X - 2 + 2 = 8X +2 + 2
9X = 8X + 4
Subtract 8X from both sides
9X - 8X = 8X - 8X + 4
1X = 4
==> X = 4
So number of children is 4
Total number of sweets bought
= 8 x 4 + 2 = 34
or
= 9 x 4 - 2 = 34
Therefore number of extra sweets to be bought = 72 - 34 = 38
Hope that helps and if you don't understand and need more explanation, please post a comment