Cod sursa(job #67234)

Utilizator ice_girl91Grosu Claudia-Gabriela ice_girl91 Data 23 iunie 2007 13:11:00
Problema Factorial Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<stdio.h>
int main()
{long int p,c=0,i,n;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%ld",&p);
i=0;
if(p==0)
	{
		printf("1");
		return 0;
	}
while(c<p)
{
	i=i+5;
	n=i;
	while(n%5==0)
	{
		c++;
		n=n/5;
	}
}
if(c==p)
	printf("%ld",i);
else
	printf("-1");
return 0;

}