what is the runtime error in this solution for the question titled "factorial"?

#include
using namespace std;
void func(long int n)
{
long int sum=0;
while(n)
{
n/=5;
sum+=n;
}
cout<<sum<<"\n";
}
int main()
{
long int arr[100];
int t,i;
cin>>t;
for(i=0;i<t;i++)
cin>>arr[i];
for(i=0;i<t;i++)
func(arr[i]);
return 0;
}

You have declared your array size as 100 where as number of inputs can be upto 100000. Increase array size and it should work fine

Keeps telling me that the time exceeded…

use bigint;
chomp($in=);
@arr=();
for($i=0;$i<$in;$i++)
{
chomp($n=);
$ans=&fact($n)."\n";
push @arr,$ans;
}
print @arr;

sub fact()
{
my num=_[0];
if($num==1)
{
return 1;
}
return $num*fact($num-1);
}

//