Palindrom.java
package com.javadevelopersguide.lab.basic;
/**
* This program illustrates how to check a number is palindrome or not.
*
* @author manoj.bardhan
*
*/
public class Palindrom {
public static void main(String[] args) {
int number = 121;
int temp = number;
int finalNumber = 0;
// Repeat the loop until the number became zero.
while (number != 0) {
// Get the First Digit (i.e. 1)
int firstDigit = number % 10;
// Get the Result number.
finalNumber = (finalNumber * 10) + firstDigit;
// Now get the remaining digits , after finding the first digit
number = number / 10;
}
// Now compare the finalNumber and number both are same or not.
if (finalNumber == temp) {
System.out.println("This number is a Palindrome.");
} else {
System.out.println("This number is not a Palindrome.");
}
}
}
Output -
This number is a Palindrome.
Happy Learning.
Follow for more details on @Facebook!!!
Find More :-
Find More :-
- Java 8 use Option - avoid NullPointerException
- Producer & Consumer problem solution using BlockingQueue.
- Write your first groovy program.
- Top 10 groovy interview question.
- Difference between groovy and java.
- What is full stack development experience.
- 5 fundamental questions of groovy.
- Write your first java program.
- Reverse string using recursive method in java.
- Comparator Interface with Examples
- Find the smallest value from array.
thanks for sharing
ReplyDeleteAdvanced Java Training In Bangalore
Selenium Training In Bangalore
Nice post keep posting
ReplyDeleteangular certification
angularjs online training
Nice article! It is very inspiring to me and I am regularly read your new posts I have gone through your post and i found it very helpful if any one who want to learn java core to advance Get a free demo call on 9311002620 https://www.htsindia.com/Courses/JAVA/core-java-training-course-institute
ReplyDeleteMasterLabz
ReplyDeletePixmash
MazeEvents
Short Video App
Best Event Management Company in Chennai
Online Training Course Certification and Class
Hi,
ReplyDeleteThanks For Sharing Information.
sales tracking software free
Sales Tracking System
Sales Tracking Excel
Sales Tracking Software for Field Sales Teams
open source sales tracking software
Best Sales Tracking Software For Small Business
This blog is so cool. I am Java training course online. This blogs helps me find out better understanding about salesforce training. Thank you for this blog!
ReplyDeleteStruggling with your academic assignment? Struggling with programming Assignment ? No worries! sampleassignment.com is finally here for you. With us, you'll get the best support for your academic problems. We've got a team of experts ready to provide you with the best Programming Assignment help. All you have to do is ask and our experts will provide it right away! Along with that, we also offer huge offers and discounts in online assignment
ReplyDeleteThanks for this blog, Keep sharing your thoughts like this...
ReplyDeleteStruts Course in Chennai
Hibernate Course in Chennai
ReplyDeleteI am really very happy to visit your blog. Directly I am found which I truly need. please visit our website for more information
Data visualization Service in USA
Awesome Article Thanks for sharing your valuable information Hire Full stack developer from Technoduce for your custom Full satck development project
ReplyDeleteGreat Information. Thanks for sharing.
ReplyDeleteJava classes in Pune
Thanks for sharing this informative post! It’s always great to explore more about Java programming. I also found this article on top data engineering companies for 2025 insightful—it could help take your projects to the next level with advanced solutions.
ReplyDelete