View Code of Problem 107

#include<stdio.h>
int main()
{
	int m,n;
	int k;
	int count0=0,count1=0,count2=0,count3=0,count4=0,count5=0,count6=0,count7=0,count8=0,count9=0;
	while(scanf("%d %d",&m,&n)!=EOF)
	{
		count0=0,count1=0,count2=0,count3=0,count4=0,count5=0,count6=0,count7=0,count8=0,count9=0;
		for(int i=m;i<=n;i++)
		{
			k=i;
			while(k)
			{
				if(k%10==0)count0++;
				if(k%10==1)count1++;
				if(k%10==2)count2++;
				if(k%10==3)count3++;
				if(k%10==4)count4++;
				if(k%10==5)count5++;
				if(k%10==6)count6++;
				if(k%10==7)count7++;
				if(k%10==8)count8++;
				if(k%10==9)count9++;
				k=k/10;
			}
		}
		printf("%d %d %d %d %d %d %d %d %d %d\n",count0,count1,count2,count3,count4,count5,count6,count7,count8,count9);		
	}
	return 0;
}
 

Double click to view unformatted code.


Back to problem 107