Posted in: C Language

# C PROGRAM TO CHECK PALINDROME NUMBER

Palindrome Number-A palindrome number is a type of number which when reverse is same as original number.

In this C program we will take input from user and check whether the given number is Palindrome or not.

Example-

INPUT

Input number-242

OUTPUT

Number given by user is palindrome.

Before writing this C program, lets go through the concept we are gonna use in our program for Palindrome Number.

## 1.Concept

For creating C program we have to go through the steps given below:

• First we have to take the input of number from user which we have to check for palindrome.
• Then we will extract(take out) its digits from last and store it in new variable.
• After extracting its digits, we will remove the digit from original number.
• We will keep the digits adding in a new variable created.
• In the last step we will compare the original number with reversed number using If-Else condition.

The concept of C programming you need to learn before writing the program is:-

Kindly go through this Topic with above provided link.

## 2.Algorithm

Here’s the Algorithm of C program to check for palindrome number.

1. START
2. Take input of number from user.
3. Using while loop check the given number is greater then 0 or not.
4. Extract the last digit of number using the modulus also called Remainder.
5. Add the Remainder digit in a new variable ‘rev’.
6. Remove the last digit by using division operator.
7. At the last check the original number and reversed number using If-Else statement.
8. STOP

## 3.C Program to check Palindrome Number

After going through the algorithm now we will take a look on the code below.Take input from user and move on to the C program.

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

int main()
{
int number,rev=0;
int remainder;
printf("Enter the number which u want to check for Palindrome: ");
scanf("%d",&number);
int num=number;
while(number>0)
{
remainder=number%10;
rev=rev*10+remainder;
number=number/10;
}
if(num==rev)
printf("given number is palindrome");
else
printf("given number is not palindrome");
getch();
return 0;

}
``````

## 5.RESOURCES

If you want to try the program on your own then please use the resources and files of this program and learn by practicing.