#include<stdio.h> main() { float mount,m; int a,b,c,d,e,f,g,h,i,j; printf("plz input the mount u need:\n"); scanf("%f",&mount); a=(int)mount/100;m=mount-a*100; if(a!=0) printf("%d张100元\n",a); b=(int)m/50;m-=b*50; if(b!=0) printf("%d张50元\n",b); c=(int)m/20;m-=c*20; if(c!=0) printf("%d张20元\n",c); d=(int)m/10;m-=d*10; if(d!=0) printf("%d张10元\n",d); e=(int)m/5;m-=e*5; if(e!=0) printf("%d张5元\n",e); f=(int)m/2;m-=f*2; if(f!=0) printf("%d张2元\n",f); g=(int)m;m-=g;m=10*m; if(g!=0) printf("%d张1元\n",g); h=m/5;m-=5*h; if(h!=0) printf("%d张0.5元\n",h); i=m/2;m-=2*i; if(i!=0) printf("%d张0.2元\n",i); j=m; if(j!=0) printf("%d张0.1元\n",j); }
第一题,真麻烦!!