//program in C to check a given number is palindrome or not
void main()
{
int a,b,c,d=0;
clrscr();
printf("Enter any number ");
scanf("%d",&a);
for(b=a;b>0;b/=10)
{
c=b%10;
d=d*10+c;
}
if(d==a)
printf("%d is Palindrome",a);
else
printf("%d is not palindrome",a);
getch();
}
Output
Enter any number 2882
2882 is Palindrome
No comments:
Post a Comment