Thursday, February 2, 2012

PALINDROME NUMBER


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

void main()
{
  int num,r,sum=0,temp;
  clrscr();
  printf("\nEnter a number:");
  scanf("%d",&num);
  temp=num;
  while(num)
  {
            r=num%10;
            num=num/10;
            sum=sum*10+r;
  }
   if(temp==sum)
            printf("\n%d is a palindrome",temp);
   else
            printf("\n%d is not a palindrome",temp);
  getch();
}

No comments:

Post a Comment