Write a c++ program to check whether the given string is palindrome or not

Write a c++ program to check whether the given string is palindrome or not. This program will check the number is palindrome or not which is the number same after reversed in the c++ programming language. This program helps you to find the palindrome in the C++ language. Character-unit palindromes are the most well-known palindromes in English. Backward and forwards, the characters are the same. Redivider, deified, civic, radar, level, rotor, kayak, reviver, racecar, madam, and refer are some instances of palindromic terms.

#include <iostream>
using namespace std;
int main()
int n, num, count, rev = 0;
cout << "Enter the number";
cin >> num;
n = num;
count = num % 10;
rev = (rev * 10) + count;
num = num / 10;
while (num != 0);
cout << "The reverse number is" << rev << endl;
if (n == rev)
cout << " The number is palindrome";
cout << " The number is not palindrome";
return 0;


Enter the number 4554                                                                                                                 

The reverse number is 4554                                                                                                           

 The number is palindrome 

What is while loop and why its required

The while loop is a programming construct that repeats a portion of code an undetermined number of times until a condition is fulfilled. Let’s assume we want to know how many times we can divide a certain integer by 2 before it becomes less than or equal to 1.

What is if else condition and why its required

The if block will be performed if the Boolean statement evaluates to true; else, the else block will be executed. Any non-zero and non-null values are presumed to be true in the C programming language, whereas zero and null values are believed to be false.