Help me in solving TODOLIST problem

My issue

My code

#include <stdio.h>

int main(void) {
	// your code goes here
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
	    int n;
	    scanf("%d",&n);
	    int d[n],s=0;
	    scanf("%d",&d[i]);
	    if(d[i]>=1000)
	    s=s+1;
	    printf("%d\n",s);
	    
	}
	return 0;
}


Problem Link: TODOLIST Problem - CodeChef

@shriyanshg9
You have not taken n array inputs correctly. You should have used a loop to get inputs for index 0 to index n.

The following code might help.

#include <stdio.h>

int main(void) 
{
    int t,n,i;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        int a[n],c=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]>=1000)    c++;
        }
        printf("%d\n",c);
    }

	return 0;
}

@shriyanshg9 You have not created a for loop for taking array inputs. I suggest you dry run your code with given test cases. It will tell you exactly where the code is facing problem (if any). Refer to @codechief1 for the solution.