View Code of Problem 107

#include<stdio.h>
int main(){
	int m,n;
	while(scanf("%d %d",&m,&n)!=EOF){
		int k;
		int count[10];
		for(int i=0;i<10;i++)
		  count[i]=0;
		for(int i=m;i<=n;i++){
			int temp=i;
			while(temp)
			{
				k=temp%10;
				count[k]++;
				temp=temp/10;
			}	
		} 
		for(int i=0;i<9;i++)
			printf("%d ",count[i]);
		printf("%d",count[9]);
		printf("\n");
	}
} 

Double click to view unformatted code.


Back to problem 107