Trying to write program that counts the number of times a number occurs in an array. The following is the code I have written so far. It doesn't give the correct output though. It seems to be counting the output incorrectly. Any pointers where I could be going wrong?

```
# include <stdio.h>
# define N 1000
int main (void)
{
int a[N], i=0, num_int, count=0, counters[11] = {0};
printf("Enter no. of integers to be inputted : ");
scanf("%d",&num_int);
for (i=0; i<num_int; i++){
a[i] = rand() % 10 + 1;
}
for( i = 1; i <num_int; i++ )
++counters[a[i]];
printf("\n");
for (i=0; i<num_int; i++){
printf("%d occurs %d times\n", a[i], counters[i]);
}
return 0;
}
```

SAMPLE OUTPUT

-------------------------------------

Enter no. of integers to be inputted : 10

2 occurs 0 times

8 occurs 1 times

5 occurs 0 times

1 occurs 1 times

10 occurs 0 times

5 occurs 3 times

9 occurs 0 times

9 occurs 0 times

3 occurs 1 times

5 occurs 2 times

Press any key to continue . . .