Cod sursa(job #1015757)
Utilizator | Data | 25 octombrie 2013 08:32:26 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p,i=1,f=1,k=1,j,o;
int main()
{
in>>p;
for(o=1; o<=p; o++)
k=k*10;
while(f%k!=0)
{
f=f*i;
i++;
}
if(p==2)
out<<i-1<<endl;
else
out<<i<<endl;
return 0;
}