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

E.g 111, 121, 8008 etc.

palindrome number

In this C program, we will check whether a number is a palindrome or not.

To check palindrome number in C, we will use while loop and division with 10. Because the number of digits is equal to the number of times a number is divisible by 10 (number / 10 ! = 0) followed by the number is equal to the quotient of the division (number = number /10).

  1. Take integer as input.
  2. Run while loop until number = 0 i.e while(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. Now outside of loop check if reverse == original_number
  7. If YES then number is palindrome else Not palindrome.

Check Palindrome Number in C

Output

When the input number is 456

Palindrome number in C

When the input number is 121

Palindrome number C program

That much only we require to do to check palindrome number using C language. If you have any doubt then comment below.

Leave a Reply

Close Menu