C program to check the given number is palindrome or not


The program code in C for checking a number is palindrome or not.

#include< stdio.h >
#include< conio.h >

main()
{
long int num,rev,temp,rem;

clrscr();
printf("Enter a number ");
scanf("%ld",&num);

temp = num;
rev = 0
while (num != 0)
{
rem = num % 10;
rev = rev * 10 + rem;
num = num / 10;
}
if ( temp == rev)
printf("%ld is a palindrome number ", temp);
else
printf("%ld is not a palindrome number ", temp);
}


K. Srinivasa Rao
Community Owner - C Language Learners


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: