Write a C program to check whether a number is palindrome or not

Palindrome Number :

A number is called Palindrome number when original number or entered number is equal ( same ) to reverse number of original number. For the example suppose enter number is = 121 and reverse of 121 will be 121. So 121 is a palindrome number.

C program palindrome Number – Source Code

/******************************************************************************
 C Program to check whether a number is palindrome nor not 

*******************************************************************************/
#include <stdio.h>

int main()
{
    int num , revN = 0 , remaindr, originalNum ;
    printf("Enter a Number : ");
    // store user inputed  number in variable num
    scanf("%d", &num);
    originalNum = num;
    // Here putting reverse integer in revN variable
    while(num !=0)
    {
        remaindr = num % 10 ;
        revN = revN * 10 + remaindr ;
        num = num / 10 ;
        
    }
    
    // If originalNum and revN are equal than it is palindrome number
     if(revN == originalNum)
        printf("%d is a Palindrome Number .", originalNum);
     else
          printf("%d is not a Palindrome Number .", originalNum);
          
    return 0;      
        
   
}

Output :

Write a C program to check whether a number is palindrome or not 1
Write a C program to check whether a number is palindrome or not 2
palindrome number in c
Share This!

Leave a Reply

Your email address will not be published. Required fields are marked *