鸡兔同笼
有鸡兔共50头,共有脚120只.
问:鸡兔分别的数量?
public class T1
{
public static void Main(string []args)
{
int head = 50;//鸡兔总数
int foot = 120;//脚
for(int x = 0;x<=head;x++)
{
int y = 50-x;
if(x * 2 + y * 4 == foot)
{
Console.WriteLine("鸡:" + x + "兔子:" + y);
}
}
}
}