帮忙看一下
统计字符串中每个数字出现的次数:#define M 100
#define N 10
#include <stdio.h>
main()
{ char a[M];
int b[N]={0,0,0,0,0,0,0,0,0,0};
int i=0;
while(getchar(a[i])!='\0')
{if(a[i]=='0')b[0]++;
else if(a[i]=='1')b[1]++;
else if(a[i]=='2')b[2]++;
else if(a[i]=='3')b[3]++;
else if(a[i]=='4')b[4]++;
else if(a[i]=='5')b[5]++;
else if(a[i]=='6')b[6]++;
else if(a[i]=='7')b[7]++;
else if(a[i]=='8')b[8]++;
else if(a[i]=='9')b[9]++;
i++;
}
for(i=0;i<N;i++)printf("%d\n",b[i]);
}
各位高手帮下忙,谢谢了!