Advertisement
UMME_RUKAYA13

Untitled

Oct 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. int n,x,y,i,j,count=0,len,a1,a2,a3,a4,a11,a22,a33,a44,s[20],p=0;
  6.  
  7. while(1)
  8. {
  9. scanf("%d",&n);
  10. if(n==0)
  11. break;
  12. for(y=10000,count=0; y<=99999; y++)
  13. {
  14.  
  15. if(y%n==0)
  16. {
  17. x=y/n;
  18. s[0]=y%10;
  19. a1=y/10;
  20. s[1]=a1%10;
  21. a2=a1/10;
  22. s[2]=a2%10;
  23. a3=a2/10;
  24. s[3]=a3%10;
  25. a4=a3/10;
  26. s[4]=a4%10;
  27. s[5]=x%10;
  28. a11=x/10;
  29. s[6]=a11%10;
  30. a22=a11/10;
  31. s[7]=a22%10;
  32. a33=a22/10;
  33. s[8]=a33%10;
  34. a44=a33/10;
  35. s[9]=a44%10;
  36.  
  37. for(i=0,p=0; i<10; i++)
  38. {
  39. for(j=i+1; j<10; j++)
  40. {
  41. if(s[i]==s[j])
  42. {
  43. p=1;
  44. break;
  45. }
  46. }
  47. }
  48.  
  49. if(p==0)
  50.  
  51. {
  52. printf("%d / %05d = %d\n",y,x,n);
  53. count=1;
  54. }
  55. }
  56.  
  57. }
  58. if(count==1)
  59. printf("\n");
  60. else if(count==0)
  61. printf("There are no solutions for %d.\n\n",n);
  62. }
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement