Cod sursa(job #6322)
Utilizator | Data | 18 ianuarie 2007 20:31:23 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <stdio.h>
int main()
{
freopen("fact.in", "r", stdin);
freopen("fact.out", "w", stdout);
long p,i,aux;
scanf("%ld",&p);
i=0;
if (p!=0){
while (p>0)
{
i+=5;
aux=i;
while (aux%5==0) {
p--;
aux=aux/5;
}
}
}
else i=1;
if (p<0) i=-1;
printf("%ld", i);
return 0;
}