Pagini recente » Cod sursa (job #1299611) | Cod sursa (job #3159659) | Cod sursa (job #2459151) | Cod sursa (job #1869242) | Cod sursa (job #1089874)
#include<stdio.h>
#include<stdlib.h>
int log5(int a){
int count=0;
while(a/5!=0)
{
count++;
a=a/5;
}
return count;
}
int main(int argc,char** argv){
FILE *fp;
int p;
int count;
if((fp=fopen("fact.in","r"))==NULL){
perror("fact.in :");
return 1;
}
fscanf(fp,"%d",&p);
fclose(fp);
if((fp=fopen("fact.out","w"))==NULL){
perror("fact.out :");
return 1;
}
if(p==0)
fprintf(fp,"%d",1);
else
fprintf(fp,"%d",5*(p-log5(p)));
fclose(fp);
return 0;
}