. WAP to Input number and find it is palindrome or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int n, n2, a=0;
printf("Enter number: ");
scanf("%d",&n);
n2=n;
while(n>0)
{
a=a*10;
a=a+n%10;
n=n/10;
}
if(n2==a)
printf("Number is Palindrome");
else
printf("Number is NOT a Palindrome");
getch();
}
Output 1:
Enter number: 155
Number is NOT a Palindrome
Output 2:
Enter number: 151
Number is Palindrome
Enter number: 155
Number is NOT a Palindrome
Output 2:
Enter number: 151
Number is Palindrome