The palindrome number in c is to check whether the number is a palindrome or not.
What is the Palindrome number?
Any number which remains the same when we reverse it.
Example: 121, 212, 12321
As we see if we reverse these numbers still all numbers remain the same.

Example: number = 121
reverse number = 121 Number is palindrome.

Algorithm for Palindrome number in c

  1. Take the input number. No
  2. Reverse the number. rev= Reverse of No
  3. If rev == No
    Print number is a palindrome
    else
    Print number is not a palindrome

C Program to Check Whether a Number is Palindrome or Not

#include <stdio.h>

int main()
{
int n, reverse = 0, t;

printf("Enter a number to check if it is a palindrome or not\n");
scanf("%d", &n);

t = n;

while (t != 0)
{
reverse = reverse * 10;
reverse = reverse + t%10;
t = t/10;
}

if (n == reverse)
printf("%d is a palindrome number.\n", n);
else
printf("%d isn't a palindrome number.\n", n);

return 0;
}

Output :

Palindrome number in c

Write A Comment