#include <stdio.h>
//兑换1角变量为y,2角为r,五角为w.三种加在一起等于10
int y,r,w;
int main(int argc, const char * argv[]) {
//一角的钱取值范围是0-10
for (y=0;y<=10;y++){
//2角取值范围0-5
for(r=0;r<=5;r++){
//五角取值范围0-2
for (w=0;w<=2;w++){
//判断相加是否等于10
if(y+(r*2)+(w*5)==10){
printf("一角%d,两角%d,五角%d\n",y,r,w);
}
}
}
}
return 0;
}
|
|