Cod sursa(job #669872)
Utilizator | Data | 27 ianuarie 2012 21:54:26 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream>
using namespace std;
int p,i,cont,z;
int nrdiv(int x)
{
while((x!=1) && (x%5==0))
{
x=x/5;
cont++;
}
}
int main()
{
i=0;
cont=0;
ifstream f("fact.in",ios::in);
ofstream g("fact.out",ios::out);
f>>p;
if(p<=0)
g<<-1;
else
{
while(cont!=p)
{
i=i+5;
nrdiv(i);
}
g<<i;
}
return 0;
}