Advertisement
Guest User

Untitled

a guest
May 26th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5.     int rekurzija (int broj,int x)
  6.     {
  7.         int cifra;
  8.         cifra=broj%10;
  9.         if(broj==0)
  10.         {
  11.             return 0;
  12.         }
  13.         else
  14.         {
  15.             if(cifra==x)
  16.             {
  17.                 return 1+rekurzija(broj/10,x);
  18.             }
  19.             else
  20.             {
  21.                 return 0+rekurzija(broj/10,x);
  22.             }
  23.         }
  24.     }
  25.  
  26. int main ()
  27. {
  28.     int x,y,rez;
  29.     scanf("%d%d",&x,&y);
  30.     rez=rekurzija(x,y);
  31.     printf("%d",rez);
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement