Eg : 1716 = 143*1*4*3 =1716so 143 is the seed of 1716.
find all possible seed for a given number.
// Input || OUTPUT // 1250 125
// 174720 1456
#include<stdio.h>
int main()
{
int n,i,j,m,f=0;
scanf("%d",&n);
printf("\n");
for(i=0;i<n;i++)
{
m=i;
j=i;
while(j)
{
m=m*(j%10);
j=j/10;
}
if(m==n)
{
printf("\n%d",i);
f=1;
}
}
if(!f)
printf("\nNo such number exit\n\n");
return 0;
}
No comments:
Post a Comment