Cod sursa(job #721392)
Utilizator | Data | 23 martie 2012 17:51:05 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *pf;
pf=fopen("fact.in","r");
int p;
fscanf(pf,"%d",&p);
fclose(pf);
pf=fopen("fact.out","w");
double aux=p;
int x=p;
while (aux>=5)
{
aux=aux/5;
x=x-floor(aux)+1;
}
fprintf(pf,"%d",x*5);
fclose(pf);
return 0;
}