pTutorial

New way to learn C programming

C Program to check palindrome

What is palindrome number?

If the number and the reverse of the number are same then the number is called palindrome number. For example, 121 and its reverse is also 121 and one more example is 999.

To check whether entered number is a palindrome or not



#include <stdio.h>

#include <conio.h>

void main()
{
int n,t,rev=0;
printf("Enter a number to check Whether no is palindrome or no:");
scanf("%d",&n);
t=n;
while(t!=0)  
{
rev=rev*10;
rev=rev+t%10;
t=t/10;

}

if(n==rev)  
{
printf("Entered number is a palindrome !!");
}
else
{
printf("Entred number is not palindrome");
}

}

Download C palindrome program

Output of program

check palindrome number

Execute a loop until the entered number will not be zero and reverse the number with the help of the modulus operator, as shown above.

See Also

C program to find string length   |   How to take string input in java using scanner   |   Jquery function example

QUOTES OF THE DAY

To make your children capable of honesty is beginning of education.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER