C Programming Examples Tutorial Index
C Number Programs

This C program checks the number given by the user whether it is a palindrome or not. It reverses the number using a while loop and matches the reversed number with the user input using the decision statement.

What Is Palindrome Number

A palindrome number is a sequence of numbers that can be read alike from the front and back in the same sequence.

Example C Program:
#include <stdio.h>

void main() {
  /* Variable Declaration and Initialization. */
  int input, reverse = 0, rem, temp;

  /* taking user input */
  printf("Please enter an integer number:");
  scanf("%d", & input);
  temp = input;

  /* Reverse the number using while loop */
  while (temp != 0) {
    rem = temp % 10;
    reverse = reverse * 10 + rem;
    temp /= 10;

  /* Check the reversed number with the user input */
  if (reverse == input)
    printf("%d is a palindrome number.", input);
    printf("%d is not a palindrome number.", input);

Program Output:

Please enter an integer number:: 1331
1331 is a palindrome number