View Code of Problem 107

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

Double click to view unformatted code.


Back to problem 107