You seem to be a little confused about how
for
loops work. Consider this one:
for(i=0; i<t; i++)
{
scanf("%d",&n);}
This is a loop that will read in
t
values, each time replacing the value of
n
. The program does not progress beyond this point until all values have been read in. So if the user enters 3 for t, then numbers 6, 20 and 64, the next statement in your program only ever sees the last value, in this case 64. What you want is to
nest your for loops e.g.
for(i=0; i < t; i++)
{
scanf("%d", &n);
int test_divisor;
for(test_divisor = 1; test_divisor < n; test_divisor++)
{
if ( )
}
}
Almost all compilers these days support C99 for loop declaration of the index, so you should use that if at all possible, e.g.
for(int i = 0; i < 10; i++)
Also think about how you find your possible divisors. Do you need to start at 0 and go all the way to n? If you're only interested in odd divisors, maybe you could start at 3 and then go up by 2, testing as you go. Maybe you don't need to go all the way to n, either. I'll leave you to think about that a bit.