Code Chef Program(Trailing Zeroes In a Factorial)

#include<stdio.h>
void findtrailingzeros(int);
int main()
{
int n,i,val,a[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("\n%d",&val);
a[i]=val;
}
for(i=0;i<n;i++)
{
findtrailingzeros(a[i]);
}
return 0;
}
void findtrailingzeros(int val)
{
int i,count=0;
for(i=5;val/i>=1;i=i*5)
count+=val/i;
printf("%d\n",count);
}

I am getting Runtime Error (SIGSEGV) But this code runs fine in Turbo C dont Know How to Fix it.Please Help

@jaiswalvj4u if u are using array to store the values then make sure your array is of appropriate size.
Read the question is says 1<=T<=100000. Make your of size a[100000] and you will get AC. Also use long int or long long int since value of N ∈ [1,109] .

here is your corrected code:

#include<stdio.h>
void findtrailingzeros(long long int);
int main()
{
long long int n,i,val,a[100001];
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("\n%lld",&val);
a[i]=val;
}
for(i=0;i<n;i++)
{
findtrailingzeros(a[i]);
}
return 0;
}
void findtrailingzeros(long long int val)
{
long long int i,count=0;
for(i=5;val/i>=1;i=i*5)
count+=val/i;
printf("%lld\n",count);
}