Pagini recente » Cod sursa (job #315589) | Cod sursa (job #1335227) | Cod sursa (job #2183778) | Cod sursa (job #3222429) | Cod sursa (job #545484)
Cod sursa(job #545484)
#include<iostream.h>
#include<fstream.h>
long int fact(int x)
{
if (x==0) return 1;
else return x*fact(x-1);
}
int main()
{
ifstream f;
f.open("fact.in");
ofstream g;
g.open("fact.out");
long int p;
f>>p;
int ok=0;
int i=1;
while (!ok)
{
//i=1;
int y=fact(i);
int k=0;
while (y%10==0)
{
k++;
y=y/10;
}
if (k==p) ok=1;
else i++;
}
if (ok) g<<i;
return 0;
}