Cod sursa(job #917447)
Utilizator | Data | 17 martie 2013 21:28:53 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<stdio.h>
using namespace std;
int s;long int p,x,cx;
int main()
{
FILE*f=fopen("fact.in","r");
FILE*g=fopen("fact.out","w");
fscanf(f,"%d",&p);
if(p==0)fprintf(g,"1");
else {while(p>0)
{ x+=5;cx=x;
while(cx%5==0)
{p--;cx/=5;}
}
if(p==0)fprintf(g,"%d",x);}
fclose(f);
fclose(g);
return 0;
}