a farmer had 24 animals. some of the animals were chicken and some were dogs. altogether there were 56 legs.

How many of the farmer's animals were chickens and how many were dogs?

3 answers

c + d = 24

Therefore c = 24 - d

2c + 4d = 56

Substitute 24-d for c in second equation and solve for d. Insert that value into the first equation and solve for c. Check by inserting both values into the second equation.
3 pigs
21 Chickens
21 chicken and 3 dogs