Pagini recente » Cod sursa (job #1973654) | Cod sursa (job #80237) | Cod sursa (job #2542269) | Cod sursa (job #692683) | Cod sursa (job #148661)
Cod sursa(job #148661)
#include<fstream.h>
long int n,p,aux,x=0,i=0;
int main ()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if (p==0) g<<1;
else {
while (x<p)
{i=i+5;aux=i;
while (aux)
{if (aux%5==0) {x++;aux=aux/5;}
else break;}
}
if (x==p) g<<i;
else g<<-1;
}
f.close();
g.close();
return 0;
}
#include<fstream.h>
long int n,p,aux,x=0,i=0;
int main ()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if (p==0) g<<1;
else {
while (x<p)
{i=i+5;aux=i;
while (aux)
{if (aux%5==0) {x++;aux=aux/5;}
else break;}
}
if (x==p) g<<i;
else g<<-1;
}
f.close();
g.close();
return 0;
}