kaloon

Totalno razlicen

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