Pagini recente » Cod sursa (job #3349182) | Cod sursa (job #139867) | Cod sursa (job #3339495) | Cod sursa (job #2534238) | Cod sursa (job #592585)
Cod sursa(job #592585)
#include <iostream.h>
#include <fstream.h>
ifstream fin("fact.in");
ofstream fout("fact.out");
int zero(int x)
{
int nrzero=0;
while (x%10==0)
{
nrzero=nrzero+1;
x=x/10;
}
return nrzero;
}
int main()
{
long p,fact=1;
int n=1,ok=1;
fin>>p;
while (ok==1)
{
fact=fact*n;
n=n+1;
if (zero(fact)==p) ok=0;
else ok=1;
}
fout<<n;
return 0;
fout.close();
}