#include using namespace std; int main() { int n, reverse = 0, rem, original; cout<<"Enter a number: "; cin>>n; original = n; // reversing a number and saving it in variable reverse // find the remainder with 10 and add it to reverse and each step multiply by 10 // divide the number by 10 until it is 0 while (n != 0) { rem = n % 10; reverse = reverse * 10 + rem; n /= 10; } // checking condition for palindrome i.e. if orignal and reverse are equal if (original == reverse) cout<