Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/ on line 108
Palindrome number program in java - CodesJava


Easy learning with example program codes

Palindrome Number Program in Java

Notice: Undefined variable: footnotelist in /home/javawith/public_html/ on line 475


Program to find that given number is Palindrome or not.

 * This program is used to find that given number is Palindrome or not.
 * @author CodesJava
public class PalindromeNumber {
      static void palindrome(int num){
            int newNum = 0, reminder, temp;
            temp = num;
            //Reverse the digit's of the number.
            while(temp != 0){
                  reminder = temp % 10;
                  newNum = newNum*10 + reminder;
                  temp = temp/10;
            //Check if reverse of all digit's of the number
            //is equal to the given number or not.
            if(newNum == num){
                  System.out.println(num +" is palindrome.");
                  System.out.println(num +" is not palindrome.");
      public static void main(String args[]){
            //method call


12321 is palindrome.


Please follow and like us:
Posted in Java   

Core Java Tutorial

Copyright © 2019 CodesJava Protection Status