C program to check for a Palindrome number

The below program checks for a Palindrome number using a loop. The C printf statement is used to output the result on the screen. A number is called as a Palindrome number if the number remains same even when its digits are reversed.

Palindrome Number: abcde = edcba

Example: 24142, 1234321, etc.

C program to check prime number

#include <stdio.h>
 
void main()
{
 
int num, x = 0;
int sum = 0;
int mod;
 
printf("Enter a number:");    
scanf("%d",&num);
int n = num;
 
while(num>0)
{  
mod = num%10;
x = x * 10 + mod;  
num = num/10;
}  
 
if(n==x)
{  
printf ("%d is a Palindrome number.", n);  
}
 
else
{  
printf ("%d is not a Palindrome number.", n);  
}  
}

Output

Enter a number:456787654
456787654 is a Palindrome number.
Please follow and like us:
Content Protection by DMCA.com