View Code of Problem 107

#include<bits/stdc++.h>
using namespace std;

int main() {
    int m,n;
    while (cin>>m>>n){
        int count[10];
        memset(count,0,sizeof(count));
        int t;
        for (int i = m; i <= n; ++i) {
            int temp=i;
            while (temp!=0){
                t=temp%10;
                count[t]++;
                temp=temp/10;
            }
        }
        for (int i = 0; i < 10; ++i) {

            cout<<count[i];
            if (i!=9)
                cout<<" ";
        }
        cout<<endl;
    }

    return 0;
}

Double click to view unformatted code.


Back to problem 107