Cod sursa(job #744089)
Utilizator | Data | 7 mai 2012 13:21:24 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
#include <fstream>
using namespace std;
int main()
{
int p,n=0,k=0,a;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if (p<=0)
g<<1;
else
{ while (k<p)
{n=n+5;
a=n;
while (a%5==0)
{a=a/5;
k++;}}
g<<n;
}
return 0;
}