Pagini recente » Cod sursa (job #614467) | Cod sursa (job #16339) | Cod sursa (job #17235) | Cod sursa (job #1388055) | Cod sursa (job #141894)
Cod sursa(job #141894)
# include <stdio.h>
long int a,b,i,c,k,l,x,q,w;
float y,z;
int main ()
{
freopen ("cifre.in","r",stdin);
freopen ("cifre.out","w",stdout);
scanf ("%li",&a);
scanf ("%li",&b);
scanf ("%li",&c);
scanf ("%li",&k);
for (i=a;i<=b;i++)
{l=0;
x=i;
while (x)
{
if ((x%10)==c)
l++;
x=x/10;
}
if (l>=k)
q++;
}
y=b-a+1;
z=q/y;
w=z*10000;
printf ("0.");
printf ("%ld",w);
return 0;
}