C
#include <stdio.h>
int main()
{
int cock,hen;
for(cock=0;cock<=20;cock++)
for(hen=0;hen<=33;hen++)
if(5*cock+3*hen+(100-cock-hen)*1.0/3==100)
printf("cock=%d hen=%d chick=%d\n",cock,hen,100-cock-hen);
}
C++
#include <iostream>
using namespace std;
int main()
{
int cock,hen;
for(cock=0;cock<=20;cock++)
for(hen=0;hen<=33;hen++)
if(5*cock+3*hen+(100-cock-hen)*1.0/3==100)
cout<<"cock="<<cock<<" "<<"hen="<<hen<<" "<<"chick="<<100-cock-hen<<endl;
}
Python
for cock in range(21):
for hen in range(34):
if 5*cock+3*hen+(100-cock-hen)/3==100:
print("cock=",cock,"hen=",hen,"chick=",100-cock-hen)