## Algorithm

2. Initialize a variable reverseNumber to 0.
3. Initialize a variable temp to store the original value of the number.
4. while (temp is not 0):
a. Extract the last digit of temp using modulo (%) operator.
b. Multiply reverseNumber by 10 and add the extracted digit.
c. Update temp by removing the last digit using integer division (/) operator.
5. If (reverseNumber is equal to the original number):
a. The number is a palindrome.
6. Else:
a. The number is not a palindrome.

## Code Examples

### #1 Code Example- C++ Programing Check Palindrome Number

```Code - C++ Programming```

``````#include <iostream>
using namespace std;

int main()
{
int n, num, digit, rev = 0;

cout << "Enter a positive number: ";
cin >> num;

n = num;

do
{
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);

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

if (n == rev)
cout << " The number is a palindrome.";
else
cout << " The number is not a palindrome.";

return 0;
}``````
Copy The Code &

Output

cmd
Enter a positive number: 12321
The reverse of the number is: 12321
The number is a palindrome.