EducationJava GUI Program to Find if a number is palindrome or not

Java GUI Program to Find if a number is palindrome or not

Java is an advance and high level programming language used to develop a variety of software and applications. Java is also known as a technology as now it is being used in cars, satellites, smartphones and TV etc.

In this article we have included the details on checking whether a entered number is a palindrome or not.

int num = Integer.parseInt(textField1.getText()); //replace textField1with actual one
int n = num; //used to store the value to check at the end of loop
int reverse=0, remainder;
while(num > 0)
{
remainder = num % 10;
reverse = reverse * 10 + remainder;
num = num / 10; }
if(reverse == n)
System.out.println(n+” is a Palindrome Number”);
else
System.out.println(n+” is not a Palindrome Number”);

 

Team Isrg KB
Team Isrg KB
Isrg Team editorial account handled by Isrg Team, management, guests, volunteers, and other private individual contributors