That implementation of the test for a palindromic number is not what was discussed before. It is simply wrong. Go back to the previous thread and implement that - if you are still minded not to use a string. Hint - you need another loop.
Here's an example of what your code is doing:
Code:
k = 423324
a=4
k=42332
rev=0*10+4
if (42332 == 4)
Put your algorithm for testing the palindromic number into a separate function that you can test. Test it.
Also, your inner loop means that you will never multiply a number by itself. I don't know whether that is your intent or not. Perhaps there are no squares that are palindromic in the given range - I don't know.
Bookmarks