C Program to Check Whether a Number is Palindrome or Not

To understand this example, you should have the knowledge of the following C programming topics:


An integer is a palindrome if the reverse of that number is equal to the original number.


Program to Check Palindrome

Output

Enter an integer: 1001
1001 is a palindrome.

Here, the user is asked to enter an integer. The number is stored in variable n.

We then assigned this number to another variable orignal. Then, the reverse of n is found and stored in reversed.

If original is equal to reversed, the number entered by the user is a palindrome.