Cod sursa(job #101212)
Utilizator | Data | 13 noiembrie 2007 09:25:14 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.24 kb |
#include <fstream.h>
int n,a[40],p,i;
int main ()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
f.close();
i=1;
while (n>0) {a[i]=n/5;n=n/5;i++;}
while (i>0) {p=p+a[i];i--;}
g<<p;
g.close();
return 0;
}