Cod sursa(job #280787)
Utilizator | Data | 13 martie 2009 16:03:52 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<stdio.h>
FILE *f=fopen("fact.in","r");
FILE *g=fopen("fact.out","w");
int p,i,n,s,nr,ok;
int main()
{
fscanf(f,"%d",&p);
if(p==0) n=1;
else{ n=0;
while(n<p) { nr+=5;
s=nr;
while(s%5==0){ s/=5;n++;}
if(n>=p) ok=1;
}
n=nr;
}
if(ok=1) fprintf(g,"0");
else fprintf(g,"%d",n);
fclose(f);
fclose(g);
return 0;
}