Recursive palindrome

Hey I need help writing this program. Any help would be appreciated. Thanks.

Write a recursive function that implements the algorithm in determining if a number is a palindrome.

Can you please help me get started.
Last edited on
Well, think about what you need the function to do. In order to determine if the number is a palindrome, you need to compare the first and last elements, then the second & second to last elements, etc, down to the middle element.

So, you'll obviously need some kind of looping structure and you'll need to make a comparison of those two elements to determine whether or not they match.

Ready. Set. GO! :)
The recursion will take care of the looping. Just write a function that compares the first character with the last character and calls itself (without those two characters) if they're the same. Be sure to take into account the length of the argument.
Topic archived. No new replies allowed.