# Palindrome Number Solution in C Programming Coding Example - Many examples in C for Palindrome check

## Algorithm

How to check if a given number is palindrome or not algorithm:

1. Declare two variables:
1. one variable store the given number
2. the other variable stores the reversed number.
2. Run a for loop or do-while loop
1. until the number of digits in the reversed number is equal to the number of digits in the given number.
3. The reversed number is created by splitting off the end-digit of the given number.
4. Check if the reversed number is equal to the given number.

Palindrome Numbers are -

1. `12321` is a palindrome number
2. `12345` is not a palindrome number
3. `1234321` is a palindrome number
4. `121` is a palindrome number

## Code Examples

### #1 C Program to check if a number is palindrome or not

```Code - C Programming```

``````#include <stdio.h>
int main()
{

int number, i, reverseNumber = 0;

printf("Enter a number: ");
scanf("%d", &number);

for(i = number; i !=0; i)
{
reverseNumber = reverseNumber * 10;
reverseNumber = reverseNumber + i % 10;
i = i / 10;
}

if(number == reverseNumber){
printf("Yes, this is a Palindrome Number");
} else {
printf("No, this is not a Palindrome Number");
}

return 0;
}``````
Copy The Code &

Input

cmd
12321

Output

cmd
Yes, this is a Palindrome Number

### #2 Palindrome Number check in C programming using While Loop

```Code - C Programming```

``````#include <stdio.h>
int main()
{
int number, i, reverseNumber = 0;

printf("Enter a number: ");
scanf("%d", &number);
i = number;

while (i != 0) {
reverseNumber = reverseNumber * 10;
reverseNumber = reverseNumber + i % 10;
i = i / 10;
}

if(number == reverseNumber){
printf("Yes, this is a Palindrome Number");
} else {
printf("No, this is not a Palindrome Number");
}

return 0;
}``````
Copy The Code &

Input

cmd
12345

Output

cmd
No, this is not a Palindrome Number

### #3 Palindrome Checker in C Using Function C Programming Example

```Code - C Programming```

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

int checkPalindrome(number){
int i = number, reverseNumber = 0;

while (i != 0) {
reverseNumber = reverseNumber * 10;
reverseNumber = reverseNumber + i % 10;
i = i / 10;
}

if(number == reverseNumber){
return 1;
}

return 0;
}

int main()
{

int number;

printf("Enter a number: ");
scanf("%d", &number);

if(checkPalindrome(number)){
printf("Yes, this is a Palindrome Number");
} else {
printf("No, this is not a Palindrome Number");
}

return 0;
}``````
Copy The Code &

Input

cmd
12321

Output

cmd
Yes, this is a Palindrome Number

## Demonstration

It's a very simple concept to get the palindrome of any given number. Check the algorithm.

Tags: Palindrome Number Solution in C Programming Coding Example, palindrome in c, c program palindrome number checker, c palindrome number checker, c palindrome number, how to get palindrome number, how to check palindrome number in c programming.