C++ Program:

- To check number is Palindrome or not

Example:

User Input: 1221

Output: Palindrome Number

#include <iostream>
using namespace std;

int main() {
  int num,num2,reverse=0;
  cout<<"Enter Your number : ";
  cin>>num;
  num2=num;
  while(num!=0){
    reverse=reverse*10+num%10;
    num/=10;
  }
  if(num2==reverse)cout<<"Palindrome Number";
  else cout<<"Not a Palindrome Number";
  return 0;
}

Output:

  Enter Your number : 12321
  Palindrome Number
Program
number

You must know first,

Palindrome Number : if a number & reverse of it are equal then the number is Palindrome number

Example :

Number: 121 & its Reverse = 121 . so it's Palindrome
Number: 123 & its Reverse = 321 . so it's NOT a Palindrome

//Save the original number
  num2=num;

//reverse the number
  while(num!=0){
  reverse=reverse*10+num%10;
  num/=10;
}

//check for the Palindrome
if(num2==reverse)
Concept

Coming Soon !

Quick
Tutorial

Quote

Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.