View Code of Problem 107

#include<stdio.h>
int main(){
	int m,n,temp,max,min;
	while(scanf("%d %d",&m,&n)!=EOF){
	int a[10]={0,0,0,0,0,0,0,0,0,0};
		if(m<n){
			max=n;
			min=m;
		}
		else if(m>n){
			max=m;
			min=n;
		}
		for(int i=min;i<=max;i++){
			temp=i;
			 while(temp){
			 	a[temp%10]=a[temp%10]+1;
			 	temp=temp/10;
			 }
		}
		for(int j=0;j<9;j++){
			printf("%d ",a[j]);
		}
		printf("%d\n",a[9]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 107