Saturday, April 18, 2009

entered number is palindrome or not



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();
}

0 comments: