Code:

`for (i=1; i <= numDigits/2; ++i) {`

if ((num % 10^i ) / 10^(i-1) != (num / 10^(numDigits - i)) % 10^(i-1)) {

palindrome = 0;

break;

}

}

This is the code I suggested. It is short. Have no idea if it works. And you still need to count the digits. This can be done easily though:

Code:

`while (num !=0) {`

num / 10;

++numDigits;

}

Now reversing a number:

Code:

`temp = num;`

for (i=0; i <= numDigits; ++i) {

rev = 10^(numDigits-i) * (temp % 10);

temp /= 10;

}

if (rev != num)

palindrome = 0;

NOTE that i haven't really paid attention to the bounds of the loop, the parenthesis and generally the details. Put you understand the idea. The second code is more readable, but a big longer. The first seems to be more slow in the worst case scenario, but it can break more quickly so it should give a better average perfomance (details, details I know)

EDIT: If you want to be even more strict, you could separate the number in two parts. If it is odd ignore the middle digit. Then reverse one part and check if the two parts are now equal. If they are it is a palindrome and you have an algorithm that runs in half speed from the other