求助请看看谢谢
求 百鸡计算的哪个 弄我的挺郁闷的 不知道是公式错误 还是C环境设置不对题 有100元钱想买100只鸡 公鸡 5元钱 一只 母鸡 3元钱 一只 小鸡 3只 一元钱
void main()
{ int gongji = 0, muji, xiaoji;
while (gongji<= 19);
{muji= 0;
while (muji<= 33)
{xiaoji = 100 - gongji - muji;
if (5.0 * gongji + 3.0 * muji + xiaoji / 3.0 == 100.0)
printf(" %d %d %d\n", gongji,muji,xiaoji);
muji ++;
}
gongji++;
}
while (gongji<= 19);}
******************************************************************************************************************************************************
void main()
{ int gongji = 0, muji, xiaoji;
do
{muji= 0;
while (muji<= 33)
{xiaoji = 100 - gongji - muji;
if (5.0 * gongji + 3.0 * muji + xiaoji / 3.0 == 100.0)
printf(" %d %d %d\n", gongji,muji,xiaoji);
muji ++;
}
gongji++;
}
while (gongji<= 19);}
******************************************************************************************************************************************
2个公式的结果都是
0 25 75
4 18 78
8 11 81
12 4 84
可是答案 确实8个
0 25 75
3 20 77
4 18 78
7 13 80
8 11 81
11 6 83
12 4 84