C语言代码-找零钱

时间:2021-01-24 05:13:54
【文件属性】:

文件名称:C语言代码-找零钱

文件大小:802B

文件格式:CPP

更新时间:2021-01-24 05:13:54

C语言

#include int main() { int m1,m2; while(scanf("%d%d",&m1;,&m2;)!=EOF) { int n,c; n=m1-m2; printf("%d\n",n); c=n; if(n>=100) { printf("100*%d",n/100); n=n0; if(n!=0) printf("+"); else printf("=%d\n",c); } if(n>=50) { printf("50*%d",n/50); n=nP; if(n!=0) printf("+"); else printf("=%d\n",c); } if(n>=20) { printf("20*%d",n/20); n=n ; if(n!=0) printf("+"); else printf("=%d\n",c); } if(n>=10) { printf("10*%d",n/10); n=n; if(n!=0) printf("+"); else printf("=%d\n",c); } if(n>=5) { printf("5*%d",n/5); n=n%5; if(n!=0) printf("+"); else printf("=%d\n",c); } if(n>=1) printf("1*%d=%d\n",n/1,c); } return 0; }


网友评论