# C++ Program to check a number is a palindrome or not using the function

In this program, You will learn how to check a number is a palindrome or not using the function in C++.

```
123 After Reverse => 321
101 After Reverse => 101
```

## Example: How to check a number is a palindrome or not using the function in C++.

```
#include<iostream>
using namespace std;
int checkNumber(int n) {
int r, rev = 0;
while (n > 0) {
r = n % 10;
rev = rev * 10 + r;
n = n / 10;
}
return rev;
}
int main() {
int n, num;
cout << "Enter a number:";
cin>>n;
num = checkNumber(n);
if (num == n) {
cout << "Number is palindrome:" << n;
} else {
cout << "The Number is not palindrome:" << n;
}
return 0;
}
```

#### Output:

```
Enter a number:121
Number is palindrome:121
```