i have written this code for problem racing horses in easy section.

but its not accepted, i dont understand whats wrong with it. please help.

```
#include<stdio.h>
#include<math.h>
void main(){
int T;
int n[10];
int a[500];
int min[10],t,k;
//input test cases
scanf("%d",&T);
int i=0,j=0;
//input horses skills for all cases
while(T--)
{
scanf("%d", &n[i]);
j=0;
t=n[i];
while(t--)
{
scanf("%d",&a[j]);
j++;
}
min[i]=abs(a[0]-a[1]);
//checking the min difference
for(j=0;j<n[i];j++)
{
for(k=j+1;k<n[i];k++)
{if(abs(a[k]-a[j])<min[i]) min[i]=abs(a[k]-a[j]);
}
}
i++;
}
for(j=0;j<T;j++)
printf("%d\n", min[j]);
}
```