Wednesday, April 16, 2014

C Program to check the number is palindrome or not

C Program to check the number is palindrome or not
 #include<stdio.h>
#include<conio.h>
void main()
{
int i,temp,sum=0,remainder,number;
clrscr();
printf("Enter the number to check Palindrome: ");
scanf("%d",&number);
temp=number;
while(number>0)
{
remainder=number%10;
number=number/10;
sum=sum*10+remainder;
}
printf("\nreverse of given number is= %d\n",sum);
if(sum==temp)
printf("number is palindrome");
else
printf("number is not palindrome");
getch();
}

No comments:

Post a Comment