Cod sursa(job #469201)
| Utilizator | Data | 6 iulie 2010 21:46:33 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <stdio.h>
int main(void)
{
FILE *in,*out;
int s,q,k,aux,c,ok,i;
long int p;
in=fopen("fact.in","r");
out=fopen("fact.out", "w");
fscanf(in, "%d", &s);
ok=1;
i=1;p=1;
while(ok)
{
p=p*i;
aux=p;
c=0;
q=1;
k=1;
while(q)
{
k=k*10;
if(aux%k==0) c++;
else q=0;
}
if(c==s)
{
fprintf(out,"%d", i);
ok=0;
}
i++;
}
fclose(out);
return 0;
}