Advertisement
damch

totalno razl2

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