Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n,x,i,totalno;
- scanf("%d %d",&n,&x);
- int rezn,rezx;
- for(i=n-1; i>=0; i--) {
- rezn=i;
- totalno=1;
- while(rezn>0) {
- rezx=x;
- while(rezx>0) {
- if(rezn%10==rezx%10) {
- totalno=0;
- break;
- }
- rezx/=10;
- }
- if(totalno==0) {
- break;
- }
- rezn/=10;
- }
- if(totalno) {
- printf("%d",i);
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement