Chickens and Pigs

Description
You are inside one of the houses of the village of the Entrag. You notice that the people that live here are very poor. They only have a table, a bed and a couple of chairs. Although these people have to live in poverty, you notice a lot of fighting equipment on the walls.

The Dwarven civilian says: Hmm.

The Dwarven civilian says: Suppose a farmer only has chickens and pigs.

The Dwarven civilian says: He has a total of 45 animals.

The Dwarven civilian says: The farmer counts a total of 116 feet.

The Dwarven civilian says: How many chickens does the farmer have then?

The Dwarven civilian says: Hmm.

Solution
Algebra! 4(pigs) + 2(chickens) = (feet) (pigs) + (chickens) = (animals)

So with 45 animals and 116 feet...

4(pigs) + 2(chickens) = 116 (pigs) + (chickens) = 45 (pigs) = 45 - (chickens) 4(45 - (chickens)) + 2(chickens) = 116 2(45 - (chickens)) + (chickens) = 58 90 - 2(chickens) + (chickens) = 58 90 - (chickens) = 58 -(chickens) = -32

Answer
(chickens) = 32

Formula
There is a quick formula for solving this puzzle. ((animals) * 2) - ((feet) / 2) = (chickens)