给出工资,看需要多少张100,50,10,5,1
#include<stdio.h>
void main(){
int i,j,n,m,gz;long sul,su=0;
int s[8]={0,0,0,0,0,0,0,0};
int b[8]={0,100,50,20,10,5,2,1};
printf("请输入人数:");
scanf("%d",&n);
printf("请依次输入各职工的工资\n");
for(i=1;i<=n;i++){
printf("输入第%d个职工工资:",i);
scanf("%d",&gz);
su=su+gz;
for(j=1;j<=7;j++){
m=gz/b[j];
s[j]=s[j]+m;
gz=gz-m*b[j];
}
}
printf("单位工资总额为:%ld\n",su);
printf("各面值币的统计结果:\n");
sul=0;
for(j=1;j<=7;j++){
printf("%3d---%3d\n",b[j],s[j]);
sul=sul+b[j]*s[j];
}
if(su==sul)printf("经检验统计无误\n");
}