Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. int n, x;
  7. scanf("%d %d", &n, &x);
  8. int kopija = x;
  9. int totalno;
  10.  
  11. for (int i = n - 1; i > 0; i--)
  12. {
  13. totalno = 0;
  14. x = kopija;
  15.  
  16. while (x > 0)
  17. {
  18. int b = i;
  19. int cifra = x % 10;
  20. x /= 10;
  21. while (b > 0)
  22. {
  23. int a = b % 10;
  24. b /= 10;
  25. if (a == cifra)
  26. {
  27. totalno = 1;
  28. }
  29.  
  30.  
  31. }
  32. }
  33. if (totalno == 0)
  34. {
  35. printf("%d", i);
  36. break;
  37. }
  38. }
  39.  
  40. if (totalno != 0)
  41. printf("0");
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement