问题及代码:
/*
时间:2016.10
作者:夏晓林
内容:换分币
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x,y,z,nummer=0;
for(x=0; x<=100; x++)
for(y=0; y<=50; y++)
for(z=0; z<=20; z++)
if(1*x+2*y+5*z==100)
{
nummer++;
printf("one penny is %d\ntwo penny is %d\nthree penny is %d\n",x,y,z);
}
printf("the nummer is %d",nummer);
return 0;
}
运行结果: