Given a number, the task is to write a recursive function which checks if the given number is palindrome or not.
Input : 121 Output : yes Input : 532 Output : no
The approach for writing the function is to call the function recursively till the number is completely traversed from the back. Use a temp variable to store the reverse of the number according to the formula which has been obtained in this post. Pass the temp variable in the parameter and once the base case of n==0 is achieved, return temp which stores the reverse of a number.
Below is the implementation of the above approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Recursive function to check if a string is palindrome
- Program to check the number is Palindrome or not
- Bash program to check if the Number is a Palindrome
- Program to check if an Array is Palindrome or not
- Program to check if an Array is Palindrome or not using STL in C++
- C Program to Check if a Given String is Palindrome
- Java program to check whether a string is a Palindrome
- Program to check if an array is palindrome or not using Recursion
- Check if a number is magic (Recursive sum of digits is 1)
- Python program to check if given string is vowel Palindrome
- Java program to check palindrome (using library methods)
- TCP Client-Server Program to Check if a Given String is Palindrome
- Recursive program for prime number
- Check if a number is Palindrome in PL/SQL
- Check if a number is Palindrome
- Recursive Program to print multiplication table of a number
- Check if number is palindrome or not in Octal
- To check a number is palindrome or not without using any extra space
- Check if binary representation of a number is palindrome
- Generate number with given operation and check if it is palindrome
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.