Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int n,x,y,i,j,count=0,len,a1,a2,a3,a4,a11,a22,a33,a44,s[20],p=0;
- while(1)
- {
- scanf("%d",&n);
- if(n==0)
- break;
- for(y=10000,count=0; y<=99999; y++)
- {
- if(y%n==0)
- {
- x=y/n;
- s[0]=y%10;
- a1=y/10;
- s[1]=a1%10;
- a2=a1/10;
- s[2]=a2%10;
- a3=a2/10;
- s[3]=a3%10;
- a4=a3/10;
- s[4]=a4%10;
- s[5]=x%10;
- a11=x/10;
- s[6]=a11%10;
- a22=a11/10;
- s[7]=a22%10;
- a33=a22/10;
- s[8]=a33%10;
- a44=a33/10;
- s[9]=a44%10;
- for(i=0,p=0; i<10; i++)
- {
- for(j=i+1; j<10; j++)
- {
- if(s[i]==s[j])
- {
- p=1;
- break;
- }
- }
- }
- if(p==0)
- {
- printf("%d / %05d = %d\n",y,x,n);
- count=1;
- }
- }
- }
- if(count==1)
- printf("\n");
- else if(count==0)
- printf("There are no solutions for %d.\n\n",n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement