In this example, We take one integer input from user and check inputted number is palindrome or not.

### What is Palindrome Number?

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, 111, 121,...,n

## C Program to Check Whether a Number is Palindrome or Not Using Loop

```	```
#include <stdio.h>
int main()
{
int n,r,sum=0,temp;
printf("enter the number=");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
printf("Number is Palindrome");
else
printf("Number is Not Palindrome");
return 0;
}
```
```

Output :

```	```
Output :- 1
enter the number=123
Number is Not Palindrome
Output :- 2
enter the number=1234321
Number is Palindrome
```
```

## C Program to Check Whether a Number is Palindrome or Not Using User Define Function

```	```
#include <stdio.h>
int checkPalindrome(int number)
{
int temp, remainder, rev=0;
temp = number;

while( number!=0 )
{
remainder = number % 10;
rev = rev*10 + remainder;
number /= 10;
}

if ( rev == temp ) return 0;
else return 1;
}

int main()
{
int number;

printf("Enter the number: ");
scanf("%d", &number);

if(checkPalindrome(number) == 0)
printf("Number is Palindrome");
else
printf("Number is Not Palindrome");
return 0;
}
```
```

Output :

```	```
Enter the number: 121
Number is Palindrome
```
```

## C Program to Check Whether a Number is Palindrome or Not Using Recursion

```	```#include <stdio.h>
#include <math.h>

int reverse(int num);
int isPalindrome(int num);
int main()
{
int num;

printf("Enter any number: ");
scanf("%d", &num);

if(isPalindrome(num) == 1)
{
printf("%d is palindrome number.\n", num);
}
else
{
printf("%d is NOT palindrome number.\n", num);
}

return 0;
}

int isPalindrome(int num)
{
if(num == reverse(num))
{
return 1;
}
return 0;
}

int reverse(int num)
{
int digit = (int)log10(num);
if(num == 0)
return 0;
return ((num%10 * pow(10, digit)) + reverse(num/10));
}
```
```

Output :

```	```
Enter any number: 15251
15251 is palindrome number.
```
```

We know that to check a palindrome number we first need to reverse the number then check whether the given number is equal to its reverse or not. If the given number is equal to its reverse then the number is palindrome otherwise not. In my previous post I explained how to find reverse of a number recursively. Here we will use the same recursive approach to find reverse and then will compare the reversed number with original number.

## C Program to Display Palindrome Numbers Between Two Intervals

```	```
#include<stdio.h>
int main(){
int num, rem, reverse_num, temp, start, end;

printf("Enter the starting point: ");
scanf("%d",&start);

printf("Enter the ending point: ");
scanf("%d",&end);

printf("Palindrome numbers between %d and %d are: ",start,end);
for(num=start;num<=end;num++){
temp=num;
reverse_num=0;
while(temp){
rem=temp%10;
temp=temp/10;
reverse_num=reverse_num*10+rem;
}
if(num==reverse_num)
printf("%d ",num);
}
return 0;
}
```
```

Output :

```	```
Enter the starting point: 1
Enter the ending point: 50
Palindrome numbers between 1 and 50 are: 1 2 3 4 5 6 7 8 9 11 22 33 44
```
```