C PROGRAMMING

write a c program to check is an entered number palendrome or not

program to check is an entered number palendrome or not

#include <stdio.h>
#include <conio.h>
int main()
{
int num, palindrome, reverse=0, remainder;
printf("Enter a number to check is it palindrome or not : ");
scanf("%d", &num);
palindrome=num;
while(num!=0)
{
remainder = num % 10;
reverse = reverse *10 + remainder;
num = num / 10;
}
if(palindrome==reverse)
{
printf("%d is a palindrome",palindrome);
}
else
{
printf("%d is not a palindrome",reverse);
}

getch();
}
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button