Cod sursa(job #893275)
Utilizator | Data | 26 februarie 2013 14:32:14 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int p,n=0,ct=0,s=1,q;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
do
{
n++;
s=s*n;
q=s;
ct=0;
while(q && q%10==0)
{
if(q%10==0)
ct++;
q/=10;
}
}
while(p!=ct);
g<<n;
f.close();
g.close();
return 0;
}