#include “stdio.h”
void main()
{
int cocks,hens,chicks;
cocks=0;
while(cocks<20)
{
hens=0;
while(hens<34)
{
chicks=100-cocks-hens;
if(chicks%3==0&&cocks*5+hens*3+chicks/3==100)
printf(“cocks=%d,hens=%d,chicks=%d”,cocks,hens,chicks);
}
hens=hens+1;
}
cocks=cocks+1;
}
>> 本文固定链接: http://www.vcgood.com/archives/2841
hens=hens+1;
cocks=cocks+1;
这两句放错位置了
应该是这样:
#include “stdio.h”
void main()
{
int cocks,hens,chicks;
cocks=0;
while(cocks<20)
{
hens=0;
while(hens<34)
{
chicks=100-cocks-hens;
if(chicks%3==0&&cocks*5+hens*3+chicks/3==100)
printf(“cocks=%d,hens=%d,chicks=%d”,cocks,hens,chicks);
hens=hens+1;
}
cocks=cocks+1;
}
}