Cod sursa(job #915859)
Utilizator | Data | 15 martie 2013 13:55:06 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include "stdio.h"
#include "malloc.h"
#include "string.h"
int main()
{
FILE *f,*g;
f=fopen("fact.in","r");
g=fopen("fact.out","w");
int x,s,p;
fscanf(f,"%d",&x);
if(x==0)
fprintf(g,"%d",1);
else
{
p = 5;
s = 0;
while(p<=x)
{
s += x/p;
p*=5;
}
fprintf(g,"%d",s);
}
return(0);
}