#codeifyoucansolve
Watson gives an integer N to Sherlock and asks him: What is the number of divisors of N that are divisible by 2?.
Input Format
First line contains T, the number of testcases. This is followed by T lines each containing an integer N.
Output Format
For each testcase, print the required answer in one line.
Constraints
1≤T≤100
1≤N≤109
Sample Input
2
9
8
Sample Output
0
3
Explanation
9 has three divisors 1, 3 and 9 none of which is divisible by 2.
8 has four divisors 1,2,4 and 8, out of which three are divisible by 2.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
try
{
//DataInputStream in = new DataInputStream(System.in);
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T>0)
{
int N = sc.nextInt();
if(N%2 == 1)
{
System.out.println('0');
}
else
{
int count=0;
int i=1;
int t =(int) Math.sqrt(N);
while(i<=t)
{
if(N%i == 0)
{
if(i%2 == 0)
count += 1;
int k = N/i;
if((k!=i) && (k%2 == 0))
count += 1;
}
i=i+1;
}
System.out.println(count);
}
}
T = T - 1;
}
catch(Exception e)
{}
}
}
Compile : http://ideone.com/5jTOAL
Folow on Twiter : https://twitter.com/codeifucansolve