LUCKFOUR: Getting wrong answer with both subtasks even though the output is the desired one.

I am getting wrong answer on codechef when I submit my code, my output obtained is correct. I do not understand where it is producing the error. I have even taken the range up til 10^9 by using unsigned long long. Here is my C code:

#include<stdio.h>
int main()
{
unsigned long long last_digit, n[1000], cntr[1000], testcase, i, j;
scanf("%lld",&testcase);

for(i = 0; i<testcase; i++)
{ last_digit = 0;
  scanf("\n%lld",&n[i]);
  while(n[i] != 0)
  {
      last_digit = n[i]%10;
      if(last_digit == 4)
      {
          cntr[i]++;
      }
      n[i] = n[i]/10;
  }
}
for(j = 0; j<testcase; j++)
{
    printf("\n%lld",cntr[j]);
}
return 0;
}

actually what question says that the number of occurrence in given number can be <=9 for the first cases that mean number of digits in number must be less than equal to the 9 and in another case number of occurrences of 4 in number is less than 10^9 so number of digits in number must be less than or equal to 10^9 .so it is clear indication is take the string to take number as input and then traverse the string and count the occurrences of 4.it’s simple. I think you have misunderstood the language of the question.Hope it solves your problem .Happy Coding:)

there is a constraint that number of test cases is always 10^5 and you have taken the limit of array storing the value of test case to be 1000 only so increase it and also you have not initialized the cntr[i] with zero so it takes garbage value.you can see this code it’s your code only, I have modified it and is working on all the test cases.
https://www.codechef.com/viewsolution/15134781
Happy Coding:)

There is suggestion too .why you are storing the test cases and results in an array. directly compute their answers and print them no need to do extra overhead.it will save your time.

But by this logic I should get the answer partially correct as I have taken unsigned long long which accepts 9 digit occurrence and gives correct output.
But my subtask 1 is wrong as well.