I have to create a function that finds all factors of any particular number. This is what i've got so far, but it doesn't seem to work all the time. It only really divides the number you input by two, which only gives one factor of even numbers. Therefore, I'm almost positive that my problem exists in the () part of the for() loop.
Any help would be greatly appreciated.
int i, a;
printf("Input a number, I'll tell you its factors.\n");
for(i = 2; i <= a; ++i)
if(a % i == 0)
printf("%d * ", a / i);