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

Ajax with jsp tutorial   |   Java print star pattern using array   |   Php file write

QUOTES OF THE DAY

Wicked men obey from fear, good men from love

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER