Palindrome Program in C Using While Loop | Palindrome Number

Write a Program to Check Whether a Number is Palindrome or Not or Palindrome Program in C Using While Loop. Now the question comes to mind What Is Palindrome?. So Palindrome means "a word, phrase, or sequence that reads the same backwards as forwards" in Hindi Languages "Ulta Seedha Ek Saman"

Palindrome Program in c

Simple if the string is "12321" compare the First '1' to the Last '1'  are same, Repeat this process by comparing the first number to the last number and the Second number to the second last number and so on. If all Numbers are the same then Number Is Palindrome. If you understood what is palindrome then try to solve the given problem Check string is a palindrome.

Check: C++ Program To Check Whether String Is Palindrome Or Not

Palindrome Program in C Using While Loop


int main() {
  /* C program to check whether a number is palindrome or not */
  int n, reverse = 0, rem, temp;

  printf("Enter Number to Check Palindrome Number or Not:\n");
  scanf("%d", & n);

  temp = n;

  while (temp != 0) {
    rem = temp % 10;
    reverse = reverse * 10 + rem;
    temp /= 10;

  if (reverse == n)
    printf("%d is a Palindrome Number.", n);
    printf("%d is Not a Palindrome Number.", n);
  return 0;

Palindrome Number in C Output

Palindrome Program in C Using While Loop

Similar to Palindrome Number

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me