To find the number of kilograms the pig gained each week, we can solve the equation (18 − 10)x + 30 = 80 for x.
First, simplify the equation: (18 − 10)x + 30 = 80
8x + 30 = 80
Subtract 30 from both sides: 8x = 50
Divide both sides by 8: x = 6.25
Therefore, the pig gained 6.25 kilograms each week.