# C program to check whether number is Palindrome or not

Palindrome Number - The number which is equal to reverse number know as Palindrome Number. For example Number 12321 is a Palindrome Number, because 12321 is equal to it’s reverse Number 12321.

In this program, we will read an integer number and check whether it is Palindrome Number or not, to check Palindrome Number firstly we will calculate it’s Reverse Number. If input Number is equal to Reverse Number then Number will be a Palindrome Number.

## Check Palindrome Number using C program

```/* C program to check whether a number is palindrome or not */

#include <stdio.h>

int main()
{
int number, revNumber=0, rem=0,tempNumber;

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

tempNumber=number;

while(tempNumber!=0)
{
rem=tempNumber%10;
revNumber=revNumber*10+rem;
tempNumber/=10;
}

/* checking if number is equal to reverse number */
if(revNumber==number)
printf("%d is a palindrome.", number);
else
printf("%d is not a palindrome.", number);

return 0;
}
```

#### Using User Define Function

```/* C program to check whether a number is palindrome or not */

#include <stdio.h>

/*function to check Palindrome Number*/
int isPalindrome(int num)
{
int tempNumber=num;
int dig,revNumber;

/*getting reverse number*/
revNumber=0;
while(num>0)
{
dig=num%10;
revNumber=(revNumber*10)+dig;
num/=10;
}

if(revNumber==tempNumber)
return 1;   /*Palindrome Number*/
else
return 0;   /*Not a Palindrome Number*/
}

int main()
{
int number;

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

if(isPalindrome(number))
printf("%d is a palindrome.", number);
else
printf("%d is not a palindrome.", number);

return 0;
}
```

Output

```    First run:
Enter an integer number: 12321
12321 is a palindrome.

Second run:
Enter an integer number: 1234
1234 is not a palindrome.
```

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates