Cod sursa(job #1649621)
Utilizator | Data | 11 martie 2016 14:25:37 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <cstdio>
using namespace std;
int n,p,x,q,i;
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
if(p==0)n=1;
else {
q=1;x=1;n=5;
while(q<p)
{ x++;
n=5*x;q++;
if(x%5==0)
for(i=5;i<=x;i*=5)
q++;
}
}
printf("%d\n",n);
return 0;
}