Given a number x between 0 to 1000000006 find smallest positive integer y such that the products of digits of y modulo 1000000007 is x.
Answers
Answered by
0
Answer:
Step-by-step explanation:
If x is 16 then y is 28 as (2*8)%1000000007 = 16
Answered by
0
Answer:
#include<stdio.h>
int main()
{
int num;
scanf("%d",&num);
if(num>=0 && num<=1000000006)
{
for(int i=num;i<=1000000006;i++)
{
int n=i;
int product=1;
while(n!=0)
{
product=product*(n%10);
n=n/10;
}
if((product%1000000007)==num)
{
printf("%d",i);
break;
}
}
}
return 0;
}
Similar questions