Cod sursa(job #907241)
Utilizator | Data | 7 martie 2013 19:06:51 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <fstream>
using namespace std;
int main()
{ int n,l,m,p; ifstream f("fact.in");ofstream g("fact.out");
f>>p;l=p;n=0;
if(p==0) g<<1;
else if(p==5) g<<-1;
else{while(l!=0) {n=n+5;
m=n;
while(m%5==0) {l--;
m=m/5; }
}
g<<n; }
return 0;}