Palindrome numbers program in C

Palindrome numbers are these numbers which remains same after reverse the digits. For example, 9, 11, 88, 121, 212, 454, 12321 etc are palindrome numbers.

Program to check palindrome number

In this check palindrome number program, we will take an integer from the user then check the number is palindrome or not. At first we will reverse the digits of the number and compare it with the given number.

If both of them are equal then we will print the number is palindrome, otherwise we will print that the number is not palindrome number. So, let’s see the program bellow.

// C program to check palindrome numbers
int main(){
  int num, mainNum, rem, temp, sum = 0;
  printf("Enter the number to check palindrome : ");
  scanf("%d", &num);
  temp = num;
  mainNum = num;

  while(num > 0){
    rem = num % 10;
    sum = (sum * 10) + rem;
    num = num/10;

  if(temp == sum){
    printf("\n%d is a Palindrome number.\n", mainNum);
    printf("\n%d is not a Palindrome number.\n", mainNum);

return 0;

Output of the Palindrome number program:

c program to check palindrome number

Check palindrome number using function

In this program we will use a function to check palindrome number. The function will take the number and check if it is palindrome or not. Here the program is.

// C program to check palindrome numbers using function

int checkPalindrome(int);

int main(){
  int num;
  printf("Enter the number here : ");
  scanf("%d", &num);

    printf("\n%d is Palindrome number.\n", num);
    printf("\n%d is not Palindrome number.\n", num);
return 0;

int checkPalindrome(int n){    // function to check palindrome number
  int total, rem = 0;

  total = n;

  while (total != 0){
    rem = rem * 10;
    rem = rem + total % 10;
    total = total / 10;

  if (n == rem){
    return 1;
    return 0;

Program output:

Enter the number here : 545

545 is Palindrome number.
Enter the number here : 993

993 is not Palindrome number.

Process returned 0 (0x0)   execution time : 4.567 s
Press any key to continue.

Previous pageArmstrong numbers

Next pageSwap numbers

More C programming and projects

C learning topics