Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int rekurzija (int broj,int x)
- {
- int cifra;
- cifra=broj%10;
- if(broj==0)
- {
- return 0;
- }
- else
- {
- if(cifra==x)
- {
- return 1+rekurzija(broj/10,x);
- }
- else
- {
- return 0+rekurzija(broj/10,x);
- }
- }
- }
- int main ()
- {
- int x,y,rez;
- scanf("%d%d",&x,&y);
- rez=rekurzija(x,y);
- printf("%d",rez);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement