C Program Check Palindrome Using Recursion
A palindromic number is a number (in some base ) that is the same when written forwards or backwards, i.e., of the form . The first few palindromic numbers are therefore are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101.
- //C program to check palindrome using recursion
-
- #include <stdio.h>
- #include <math.h>
- int rev(int num);
- int palin(int num);
- int main()
- {
- int num;
- printf("Enter any number: ");
- scanf("%d", &num); //taking input from user
-
- if(palin(num) == 1) //calling the recursive function
- {
- printf("%d is palindrome number.\n", num);
- }
- else
- {
- printf("%d is NOT a palindrome number.\n", num);
- }
-
- return 0;
- }
-
- int palin(int num)
- {
- if(num == rev(num))
- {
- return 1;
- }
- return 0;
- }
- int rev(int num)
- {
- //To find no. Of digits
- int digit = (int)log10(num);
- if(num == 0)
- return 0;
- return ((num%10 * pow(10, digit)) + rev(num/10));
- }
Output

Solution not working or have any suggestions? Please send an email to [email protected]
Download Android App