Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int a,b;
- scanf("%d%d",&a,&b);
- int i;
- int naj=0;
- for(i=a-1;i>0;i--){
- int temp=i;
- int temp2=b;
- int tocno=0;
- while(temp){
- tocno=1;
- int k=temp%10;
- if(k==temp2%10){
- tocno=0;
- break;
- }
- temp2/=10;
- temp/=10;
- if(!temp2)
- temp2=b;
- }
- if(tocno){
- naj=i;
- break;
- }
- }
- if(naj){
- printf("%d",naj);
- }else
- printf("Nema takov broj");
- return 0;
- }
Add Comment
Please, Sign In to add comment