#include <stdio.h>
int main()
{
int num;
scanf ("%d",&num);
int a[10] = {0};
int i;
int temp;
for (i=0; i<=num; i++)
{
if (i==0)
{
a[i]++;
continue;
}
temp = i;
while (temp)
{
a[temp%10]++;
temp = temp / 10;
}
}
for (i=0; i<10; i++)
{
printf ("a[%d]: %4d\n",i,a[i]);
}
return 0;
}
统计0~n中0~9的个数
最新推荐文章于 2022-10-15 10:37:13 发布