Cod sursa(job #154310)
| Utilizator | Data | 11 martie 2008 09:19:31 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <stdio.h>
int main()
{
FILE *fin, *fout;
fin=fopen("fact.in", "r");
fout=fopen("fact.out", "w");
long p,a=0,b=0,n=1,x;
fscanf(fin, "%ld", &p);
while(a<p || b<p)
{
x=n;
while(x%2==0)
{
a++;
x/=2; }
while(x%5==0)
{
b++;
x/=5;}
n++;
}
fprintf(fout, "%ld", n);
fclose(fin); fclose(fout);
return 0;
}
