Palindrome Program in C++

c++

 

 

 

 

 

 

 

#include iostream.h
#include conio.h
void main()
{clrscr();
int a,b,c,d=0;
cout<<“Enter number:”;
cin>>a;
b=a;
do
{
c=b%10;
d=(d*10)+c;
b=b/10;
}
while (b!=0);
cout<<d<<endl;

if (a==d)
{
cout<<“It is a palindrome!”;
}
else
{
cout<<“It is not a palindrome!”;
}
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *