Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int povtoruvanje(int a,int b){
- if (a==0&&b==0)
- return 0;
- else{
- if(a%10==b%10)
- return 1+povtoruvanje(a/10,b/10);
- else return povtoruvanje(a/10,b/10);
- }
- }
- int main()
- {
- int a,b;
- int n;
- scanf("%d",&n);
- int i;
- int cuvaj;
- for(i=1;i<=n;i++)
- {
- int brcifri=0;
- scanf("%d %d",&a,&b);
- if (a>=b){
- cuvaj=a;
- while(cuvaj>0)
- {
- brcifri++;
- cuvaj/=10;
- }
- }
- else if(b>a){
- cuvaj=b;
- while(cuvaj>0)
- {
- brcifri++;
- cuvaj/=10;
- }
- }
- int l=povtoruvanje(a,b);
- printf("%.2f%%\n",(l/(float)brcifri)*100);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement