Cod sursa(job #6321)
Utilizator | Data | 18 ianuarie 2007 20:29:30 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 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;
while (p>0)
{
i+=5;
aux=i;
while (aux%5==0) {
p--;
aux=aux/5;
}
}
if (p<0) i=-1;
printf("%ld", i);
return 0;
}