using System; using System.Collections.Generic; using System.Text; namespace lession5 { class Program { static void Main(string[] args) { //百元白鸡问题 //I+J+K=100; 5*I+3*j+K/3=100; int gj, mj, xj; for ( gj = 0; gj <= 20; gj++) { for (mj = 0; mj < 33; mj++) { xj = 100 - mj - gj; if ((5 * gj + 3 * mj + xj / 3.0)== 100) { Console.WriteLine("公鸡:{0}母鸡:{1}小鸡:{2}",gj,mj,xj); } } } Console.ReadLine(); } } }