Check Given Number Palindrome or Not in Java

In this post we’ll see how to write a Java program to check whether a given number is palindrome or not.

A number is said to be a palindrome if it remains same when reversed as example 1221, 1001.

Java program – Given number is palindrome or not

In order to find if a given number is palindrome or not in Java you can reverse the number and then compare it with the original number. If both are same then the passed number is a palindrome.

In order to reverse the passed number you will have to do modulo division with 10 to get the last digit (remainder) and then form the new number.

Output

That’s all for the topic Java Program to Check Given Number Palindrome or Not. If something is missing or you have something to share about the topic please write a comment.


You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.