This Program Takes Integer From end user and integer is reversed. if reversed integer equal to entered user integer then that number is palindrome another wise number is not palindrome.
Program -
#include<iostream.h>
Program -
#include<iostream.h>
#include<conio.h>
void main()
{
int
a,temp,d,rev=0;
cout<<"enter
the number: ";
cin>>a;
temp=a;
while(temp>0)
{
d=temp%10;
temp/=10;
rev=rev*10+d;
}
if(rev==a)
cout<<a<<"
is palindrome";
else
cout<<a<<"
is not palindrome";
getch();
}
Output -
enter the number:
212
212 is palindrome
enter the number:
567
567 is not
palindrome
0 comments:
Post a Comment