View Code of Problem 107

#include <stdio.h>

int main(void)
{
    int m,n;
    while(scanf("%d%d",&m,&n) != EOF && m && n)
    {
        int arr[10] = {0},i,temp;
        int max = (m > n) ? m : n;
        int min = (m > n) ? n : m;
        for(i = min;i <= max;i++)
        {
            temp = i;
            while(temp)
            {
                arr[temp % 10]++;
                temp /= 10;
            }
        }
        for(i = 0;i < 10;i++)
        {
            if(i != 9)
                printf("%d ",arr[i]);
            else
                printf("%d\n",arr[i]);
        }

    }
}

Double click to view unformatted code.


Back to problem 107