C Program to Check Whether a Number is Palindrome or Not
Here I shared C Program to Check Whether a Number is a Palindrome or Not using a while loop statement. Or we can say that check whether the reversed number is equal to the original number or not.
For example, if the user enters 46564 then the output will:
46564 is Palindrome Number
OR
if the user enters 124 then the output will:
124 is Not Palindrome Number
Here I shared C Program to Check Whether a Number is a Palindrome or Not using a while loop statement. Or we can say that check whether the reversed number is equal to the original number or not.
For example, if the user enters 46564 then the output will:
46564 is Palindrome Number
OR
if the user enters 124 then the output will:
124 is Not Palindrome Number
#include<stdio.h>
int main()
{
int n,rev=0,temp;
printf("\n Enter a number to check if it is a palindrome number or not:");
scanf("%d",&n);
temp=n;
while(temp!=0)
{
rev=rev*10;
rev=rev+temp%10;
temp=temp/10;
}
if(n==rev)
{
printf("\n %d is a palindrome number",n);
}
else
{
printf("\n %d is not a palindrome number",n);
}
return 0;
}
NOTE: You have any problem in above C Program do not hesitate and write your problem in the comment box. I will support your problem.