Skip to content
Home » C Programs » Palindrome Program in C Using While Loop

Palindrome Program in C Using While Loop

This program will the result which is the element is palindrome or not in c. This program will show you whether c program to check palindrome number. 

Palindrome Number Definition

Character-unit palindromes are the most well-known palindromes in English. Backwards and forwards, the characters are the same. 

Redivider, deified, civic, radar, level, rotor, kayak, reviver, racecar, madam, and refer are some examples of palindromic terms. noon, civic, racecar, level, and mom are examples of common palindromic—that is, palindrome—words. 

The Finnish word for “soapstone dealer” is said to be the world’s longest palindrome: saippuakivikauppias

While Loop in C Program

A “While” Loop is used to repeat a block of code an unknown number of times until it meets a condition. If we want a user to enter a number between 1 and 10, 

for example, we don’t know how many times the user might enter a larger number, so we keep asking “while the value is not between 1 and 10.” This is sample program to execute the c program to check palindrome number for beginners.

If Else Statement in C Program

The if block will be run if the Boolean statement evaluates to true; else, the else block will be executed. 

Any non-zero and non-null values are assumed to be true in the C programming language, while zero and null values are assumed to be false.

C Program to Check Palindrome Number

//c program to check palindrome number
#include <stdio.h>
int main()
{
int num, rev=0, rem,temp;
printf("Enter an integer: ");
scanf("%d", &num);
temp=num;
while(temp!=0)
{
rem=temp%10;
rev=rev*10+rem;
temp/=10;
}
if(rev==num) 
printf("%d is palindrome number",num);
else
printf("%d is not palindrome number",num);
return 0;
}

Output of c program to check palindrome number:

Enter an integer:

4545

4545 is not palindrome number