Resources » Articles/Knowledge Sharing » Computer & Technology

C program to check the given number is palindrome or not


Posted Date: 22-Feb-2009  Last Updated:   Category: Computer & Technology    
Author: Member Level: Gold    Points: 3


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


Did you like this resource? Share it with your friends and show your love!




Responses to "C program to check the given number is palindrome or not"

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

Feedbacks      

Post 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    Online Members

    Orley Luged
    More...
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.