Pagini recente » Cod sursa (job #2747930) | Cod sursa (job #2215920) | Cod sursa (job #926802) | Cod sursa (job #2137395) | Cod sursa (job #30491)
Cod sursa(job #30491)
#include<fstream.h>
#include<stdio.h>
FILE *in,*out;
int cate(int x)
{
int hmm=0;
while(x%5==0 && x!=0)
{
x=x/5;
hmm=hmm+1;
}
return hmm;
}
int main(void)
{
long p,a=10,suma=2;
in=fopen("fact.in", "r");
out=fopen("fact.out","w");
fscanf(in,"%d",&p);
fclose(in);
if(p==0) fprintf(out,"1");
else if(p==1) fprintf(out,"5");
else if(p==2) fprintf(out,"10");
else {
while(suma<p)
{
a=a+5;
suma+=cate(a);
}
}
fprintf(out,"%d",a);
fclose(out);
return 0;
}