百钱买百鸡。可咋不出鸡呢?
#include<stdio.h>int main()
{
float cocks=0,hens,chicks;
while(cocks<=19)
{
while(hens<=33)
{ hens=0;
chicks=100-hens-chicks;
if(5.0*cocks+3.0*hens+chicks/3.0==100)
printf("%d %d %d",cocks,hens,chicks);
hens++;
}
chicks++;
}
return 0;
}
编译没错。但运行没鸡呢? 大侠们帮看下哪里有问题呀 3Q!