#include <stdio.h> int main() { int gong, mu, xiao, n, m; m = 100; n = 100; for (gong = 0; gong <= n / 5; gong++) { for (mu = 0; mu <= n / 3; mu++) { xiao = n - gong - mu; if (gong * 5 + mu * 3 + xiao / 3 == m && mu + gong + xiao == n && xiao % 3 == 0) { printf("公鸡个数%d,母子个数%d,小鸡个数%d.\n", gong, mu, xiao); } } } return 0; }
公鸡5元,母鸡3元,小鸡一元3只,用100元买100只鸡,请问公鸡、母鸡、小鸡各多少只?