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