C Program to Check Whether a Number is Palindrome or Not

Below is a simple C program to check whether a number is a palindrome or not.

Program :

#include<stdio.h>
#include<conio.h>
main()
{
int n,r=0,t;
printf(“Enter a number to reverse : “);
scanf(“%d”,&n);
t=n;
while(n!=0)
{
r=r*10;
r=r+n%10;
n=n/10;
}
if(t==r)
{
printf(“%d is a Palindrome number.”,t);
}
else
{
printf(“%d is not a Palindrome number.”,t);
}
}

Output:

Leave a Comment

Your email address will not be published.

Shopping Basket
Verified by MonsterInsights