Pagini recente » Cod sursa (job #2670135) | Cod sursa (job #918338) | Cod sursa (job #81681) | Cod sursa (job #2789715) | Cod sursa (job #53351)
Cod sursa(job #53351)
#include<fstream.h>
#include<math.h>
int main(void)
{
int n,x,i,zero;
ifstream in("fact.in");
in>>n;
in.close();
zero=1;
for(x=5;zero<n;x+=5)
{
if(x%(5*5*5*5*5*5)==0)zero+=5;
else if(x%(5*5*5*5*5)==0)zero+=4;
else if(x%(5*5*5*5)==0)zero+=3;
else if(x%(5*5*5)==0)zero+=2;
else if(x%(5*5)==0)zero++;
zero++;
}
if(n==0) x=0;
if(zero>n) x=-1;
ofstream out("fact.out");
out<<x<<'\n';
out.close();
return 0;
}