I have a function to tell if a number is abundant, as defined by Project Euler Problem 23, but my function is saying that all numbers are abundant. I'm thinking that it's a problem with my for loop, but I'm not sure where.
1 2 3 4 5 6 7 8 9
bool abundant(int num)
{
//declare variables
int sum = 0;
for(int x = 1; x * x <= num; sum += num % x ? 0 : (x * x == num ? x : x + num / x), x++);
return sum > num;
}//end abundant