The problem statement is:
Watson gives an integer NN to Sherlock and asks him: What is the number of divisors of NN that are divisible by 2?.
Input Format
First line contains TT, the number of testcases. This is followed by TT lines each containing an integer NN.
Output Format
For each testcase, print the required answer in one line.
Constraints
1≤T≤1001≤T≤100 1≤N≤109
Sample Input :
2\n 9\n 8
Sample Output:
0\n 3
I have typed '\n' which means the next integer will be in a new line. Hacker Rank would not accept my code due to timeout. Please help me optimise this C code.
My C code is :
int main() {
int length,number,i,count =0;
scanf("%d",&length);
while(length--){
scanf("%d",&number);
for(i=2;i<=number/2;i++){
if(number % i == 0 && i % 2 == 0){
count = count + 1;
}
}
if(number % 2 == 0){
count = count + 1;
}
printf("%d\n",count);
count =0;
}
return 0;
}