第四章例4-12(2)

/* 45人真好搬45块砖 */
#include<stdio.h>
int main(void)
{
    int men,women,child;
    for(men=0;men<=15;men++)
        for(women=0;women<=22;women++){
            child=45-women-men;
            if(men*3+women*2+child*0.5==45)
                printf("men=%d,women=%d,child=%d\n",men,women,child);
        }
        
        return 0;
}

posted @ 2013-10-05 23:18  刘睿1994  阅读(116)  评论(0编辑  收藏  举报