Check number is Palindrome or not: C Program


Palindrome number in C: A palindrome number is a number such that if we reverse it, it will not change. For example some palindrome numbers examples are 121, 212, 12321, -454. To check whether a number is palindrome or not first we reverse it and then compare the number obtained with the original, if both are same then number is palindrome otherwise not. C program for palindrome number is given below.

Formal Definition

Although palindromic numbers are most often considered in the decimal system, the concept of palindromicity can be applied to the natural numbers in any numeral system. Consider a number n > 0 in base b ≥ 2, where it is written in standard notation with k+1 digits ai as:


with, as usual, 0 ≤ ai < b for all i and ak ≠ 0. Then n is palindromic if and only if ai = aki for all i. Zero is written 0 in any base and is also palindromic by definition.

Decimal Palindromic numbers

All numbers in base 10 with one digit are palindromic. The number of palindromic numbers with two digits is 9:

{11, 22, 33, 44, 55, 66, 77, 88, 99}.

There are 90 palindromic numbers with three digits (Using the Rule of product: 9 choices for the first digit – which determines the third digit as well – multiplied by 10 choices for the second digit):

{101, 111, 121, 131, 141, 151, 161, 171, 181, 191, …, 909, 919, 929, 939, 949, 959, 969, 979, 989, 999}

Palindrome number algorithm

1. Get the number from user.
2. Reverse it.
3. Compare it with the number entered by the user.
4. If both are same then print palindrome number
5. Else print not a palindrome number.

[message_box title=”Program ” color=”red”]

/*  write a C program to check whether a number is palindrome or not */

/* Written by Utpal Chaudhary */

/*Student of L.D COLEGE OF ENGINEERING,Ahmedabad-15,Gujarat */

#include <stdio.h>
#include <conio.h>

void main()
int n, reverse=0, rem,temp;

printf(“Enter an integer: “);
scanf(“%d”, &n);


while(n >0)
/* Checking if number entered by user and it’s reverse number is equal. */

printf(“%d is a palindrome.”,temp);
printf(“%d is not a palindrome.”,temp);


[message_box title=”Output” color=”red”]
Enter an integer:121
121 is a palindrome.

Previous articleGRAPHICS LCD
Next articleDPDT RELAY
I am third year student of computer engineering in L.D COLLEGE OF ENGINEERING,Ahmedabad.

Leave a Reply

Be the First to Comment!

Notify of