1.设X,Y,Z;
2.得到条件10*X+*Y+Z=50;
3.根据条件进行遍历;
#include<iostream>
using namespace std;
int main(){
for(int x=0;x<=5;x++){
for(int y=0;y<=10;y++){
int z=50-10*x-5*y;
if(z>=0)
printf("一元为%-3d 五角为%-3d 一角%-3d\n",x,y,z);
}
}
return 0;
}
标签:%-,21,int,分币,day,3d From: https://www.cnblogs.com/drz1145141919810/p/17376743.html