View Code of Problem 107

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

long int nums[10]={0};

void check(int num){
	while(num!=0){
		int a = num%10;
		nums[a]++;
		num = num/10;
	}

}


int main(){
	
	int start,end;
	while((scanf("%d %d",&start,&end)!=EOF)){
		int i;
		for(i=0; i<10; i++)
			nums[i] = 0;
		int temp;
		if(start>end){
			temp = start;
			start = end ;
			end = temp;	
		}

		for(int i=start; i<=end; i++)
			check(i);
		
		
		for(i=0; i<9; i++)
			printf("%d ",nums[i]);
		printf("%d\n",nums[i]);
	
	
	}


	return 0;
}

Double click to view unformatted code.


Back to problem 107