View Code of Problem 107

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

int main()
{
    int M,N,i;


    while(scanf("%d%d",&M,&N)!=EOF)
    {
        int a[10]={0};
    for(i=M;i<=N;i++)
    {
        int m,t;
        t=i;
        while(t!=0)
        {
            m=t%10;
            a[m]++;
            t=t/10;
        }
    }
    for(i=0;i<10;i++)
    {

        if(i==9)
        {
            printf("%d\n",a[i]);
        }
        else
        {
            printf("%d ",a[i]);
        }
    }
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 107