Cod sursa(job #667025)
Utilizator | Data | 22 ianuarie 2012 15:42:14 | |
---|---|---|---|
Problema | Factorial | Scor | 45 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p, a,c,nr;
fin >> p;
a = 1;
c = 5;
if (p == 0)fout << 1;
else
{
while (a < p)
{
c = c+5;
nr = c;
while(nr %5==0)
{
nr= nr/5;
a++;
}
}fout <<c;
}
fin.close();
fout.close();
return 0;
}