Tuesday, 25 August 2015

Programming in C to find the number is either Palindrome or not.

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,rev=0,rem;
printf("Enter a number: ");
scanf("%d",&a);
b=a;
while (a>0)
{
rem=a%10;
rev=(rev*10)+rem;
a=a/10;
    }
    if (rev==b)
    {
printf("%d  is a Palindrome Number.",rev);
}
else
printf("%d is not a Palindrome Number.",b);
getch();
}

No comments:

Post a Comment