-- --

C program to check if inputted number is palindrome or not

Definition of palindrome number –  A palindrome number is a sequence of digits that can be read in the same way in both the directions , from left to right and right to left. For ex – 121, 123321, etc

Below is the C program in the C programming language to check if the inputted number is a palindrome number or not-

/* C program to check if the inputted number is palindrome number or not */
#include<stdio.h>
void main()
{
     int n,n2,n3=0,i;
     
     printf("Enter any number to check if no. is palindrome or not \n");
     scanf("%d",&n);
     
     n2=n;
     do
     {
          i=n%10;
          n=n/10;
          n3=n3*10+i;
     }
     while(n>0);
     
     if(n3==n2)
     {
               printf("%d is a palindrome number",n3);
     }
     else
     {
               printf("%d is not a palindrome number",n2);
     }
     getch();
}

yashan has written 69 articles

One thought on “C program to check if inputted number is palindrome or not

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>