Problem: Write a C program to check whether a number is a Palindrome or not.

Palindrome number is that number which when reversed, is equal to the original number.

Examples: 111, 121, 8008 etc.

palindrome number

Steps to Check Palindrome in C:

  1. Input a number.
  2. Run while loop with condition (number != 0)
  3. Divide the number by 10
  4. Store the remainder into another variable reverse as stated reverse = reverse *10 + remainder
  5. Update the number as number = number/10
  6. After the loop ends, check if reverse == original_number
  7. If yes, then the number is palindrome else not.

Here is the implementation of the steps in C.

Output

When the input number is 456.

Palindrome number in C

When the input number is 121.

Palindrome number C program

In this tutorial, we learned what is palindrome number and how to check palindrome number in C programming language.

Leave a Reply