第一题
main( ) { int cocks,hens,chicks; cocks=0; while(cocks<=19) { hens=0; while(hens<=33) { chicks=100-cocks-hens; if(5*cocks+3*hens+chicks/3==100&&chicks%3==0) printf("%d,%d,%d\n",cocks,hens,chicks); hens=hens+1; } cocks=cocks+1; } 运行出错 第二题 #include <stdio.h> void main( ) { int a,b,c;/*a为一分,b为两分,c为5分*/ a=1,b=1,c=1; while(c<=19) {a=1,b=2&&a=3,b=1; while(b<=47) {a=1,c=1; while(a<=93) {b=1,c=1} } } if(a+2b+5c==100) printf("%d,%d,%d,",a,b,c); a++;b++;c++; } 请给为哥哥姐姐指教 }