View Code of Problem 107

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n,m;
	int i,j;
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		int a[10]={0};
		for(i=n;i<=m;i++)
		{
			int k=i;
			int x;
			while(k/10!=0)
			{
				x=k%10;
				a[x]++;
				k=k/10;
				
			}
			a[k]++;
		}
		for(j=0;j<10;j++)
			{
				if(j!=9)
				{
					printf("%d ",a[j]);
				}
				else
				{
					printf("%d\n",a[j]);
				}
			}
}
	return 0;
}

Double click to view unformatted code.


Back to problem 107