document.write( "Question 698414: there are 13 animals in the barn.some are chicken some are pigs. there are 40 legs in all. how many of each animal are there? \n" ); document.write( "
Algebra.Com's Answer #430638 by Simnepi(216)\"\" \"About 
You can put this solution on YOUR website!
You have to make two equations and solve them together.
\n" ); document.write( "Let the number of chickens be called c and let the number of pigs be p.
\n" ); document.write( "there are 13 animals in the barn so
\n" ); document.write( "p + c = 13 this is equation 1.
\n" ); document.write( "Since pigs have 4 legs the number of legs that the pigs have altogether is 4p and similarly chickens only have 2 legs so the number of their legs will be 2c.
\n" ); document.write( "so 2c + 4p = 40 this is equation 2
\n" ); document.write( "using equation 1 we can see that c = 13 - p
\n" ); document.write( "putting this value into equation 2 and solving
\n" ); document.write( "2X(13-p) + 4p = 40
\n" ); document.write( "26-2p+4p = 40
\n" ); document.write( "2p = 14
\n" ); document.write( "p = 7 there are 7 pigs
\n" ); document.write( "hence there are 6 chickens
\n" ); document.write( "
\n" );