FCTRL: Time limit exceeded

Hey, I tried solving the factorial problem, and I ended up with “Time limit exceeded”. Here’s my code. Also, this is a link to the problem for reference: http://www.codechef.com/problems/FCTRL/

#include<stdio.h>
#include<math.h>
int main()
{
int t,i=0, s=0, c=0,j=0,n;
int* array;
scanf("%d", &t);
array = malloc(t * sizeof(int));
while (i<t)
{
scanf("%d", &array[i]);
i = i + 1;
}
i=0;
while(i<t)
{
n = array[i];

	//Try to find the highest power of 5 that divides n
	while (n!=0)
	{
		n = n / 5;
		if (n!=0)
			c = c + 1;
	}
	
	//Now I have c, the greatest exponent
	s = 0;
	for (j=1; j<=c; j++)
	{
		s = s + array[i]/pow(5,j);
	}
	array[i] = s;
	i = i + 1;
}

for (i=0;i<t;i++)
	printf("%d\n",array[i]);
	
return 0; 

}

Could someone help me out please?