Cod sursa(job #53334)
Utilizator | Data | 21 aprilie 2007 20:04:44 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream.h>
#include<math.h>
int main(void)
{
int n,x,putere,i;
int suma;
ifstream in("fact.in");
in>>n;
in.close();
for(x=1;suma!=n;x++)
{
suma=0;
putere=5;
for(i=1;i<=5;i++)
{
suma+=x/putere;
putere*=5;
}
}
x--;
if(n==0) x=0;
ofstream out("fact.out");
out<<x<<'\n';
out.close();
return 0;
}