C program to print the palindrome number program using while loop

C program to print the palindrome number program using while loop. This program will the result which is the element is palindrome or not in C. This program will show you whether the number is palindrome number or not a 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

Enter an integer:

4545

4545 is not palindrome number

What is palindrome and which is largest palindrome in c

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

What is while loop and if else statement

While

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.”

If else

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.