Java Program:

- To check number is Palindrome or not

Example:

User Input: 1221

Output: Palindrome Number

import java.util.Scanner;
public class Palindrome {
  public static void main(String []args) {
    int num,num2,reverse=0;
    Scanner userInput = new Scanner(System.in);
    System.out.print("Enter your number : ");
    num = userInput.nextInt();
    num2=num;
    while(num!=0) {
      reverse=reverse*10+num%10;
      num/=10;
    }

    if(num2==reverse)System.out.println("Palindrome Number");
    else System.out.println("Not a Palindrome Number");
  }
}

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

The best preparation for good work tomorrow is to do good work today.