#include <stdio.h>
#include<string.h>
int number(char a[],int b)
{
    int x[1000];
    int p,q=1;
    for(int i=0;i<b;i++)
    {
        q=1;
        p=strlen(a);
        if(p==1)
        {
            return 100;
        }
        for(int j=0;j<p;j++)
        {
            x[j]=a[j]-'0';
            q*=x[j];
        }
        sprintf(a,"%d",q);
    }
    if(strlen(a)==1)
    {
        return q;
    }
    else
    {
        return 100;
    }
}

int main() {
    int a,b,c,p,w=0;
    char x[1000];
    int o[1000];
    scanf("%d %d %d",&a,&b,&c);
    for(int i=a;i<=b;i++)
    {
        sprintf(x,"%d",i);
        p=number(x,c);
        if(p<10)
        {
            o[w]=i;
            w++;
        }
    }
    printf("%d\n",w);
    for(int i=0;i<w;i++)
    {
        printf("%d\n",o[i]);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: