Cod sursa(job #111032)
Utilizator | Data | 28 noiembrie 2007 15:17:18 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include<stdio.h>
int main()
{FILE*f,*g;
f=fopen("fact.in","r");
g=fopen("fact.out","w");
long t,p,i=5,k=0;
fscanf(f,"%ld",&p);
if(!p) {fprintf(g,"1");
return 0;
}
while(k!=p)
{t=i;
while(!(t%5))
{t/=5;k++;}
if(p==k)
fprintf(g,"%ld",i);
i+=5;
}
return 0;
}