Important Questions

C++ Program to Check Whether a Number is Palindrome or Not

//C++ Program to Check Whether a Number is Palindrome or Not
//header files
#include<iostream.h>
#include<conio.h>

void main()
{

clrscr();
int n, num, rem, rev = 0;
cout << "Enter a positive number: ";
cin >> num;
n = num;
do
{

rem = num % 10;
rev = (rev * 10) + rem;
num = num / 10;

} while (num != 0);

cout << "The reverse of the number is: " << rev << endl;

if (n == rev)
{

cout <<n<< " is a palindrome number .";

}
else
{

cout <<n<< " is not a palindrome number .";

}
getch();

}

Output


You can also see a video how to run this program