A program to check if the input number is pallindrome in C++

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n, temp, a, rev=0;
cout<<“enter a number”;
cin>>n;
temp=n;
while(n!=0)
{
a=n%10;
n=n/10;
rev=rev*10+a;
};
if(temp==rev)
{
cout<<“Pallindrome”;
}
else
{
cout<<“Not pallindrome”;
}
getch();
}

Output:

Leave a Reply

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