heads: r+c = 35
feet: 4r+2c = 94
Now just solve for r and c, in any of several ways.
1. Think about it, if all the chickens raise one of their legs, and the rabbits raise two of their legs, then it's 94/2=47.
2. So if there's even one rabbit in the cage, the number of legs will have one more than the number of heads for each rabbit there are.
3. So you subtract the half amount of legs by the number of heads, and it's 47-35=12, so there are 12 rabbits in the cage.
4. If there are 12 rabbits in the cage, then 12 rabbits = 12 heads and 48, and so you subtract the total number of heads/legs from the number of heads/legs that belong to a rabbit, which is 94-48=46, and 35-12=23.
5. So there are 23 chickens and 12 rabbits.