How to Create a Program to Check a Number is Palindrome or not in Core Java

In this tutorial how to create a Program to check a number is palindrome or not in Core Java is shown.

Code:

Palindrome.java

class Palindrome
{
public static void main(String args[])
{
int number=Integer.parseInt(args[0]),sum=0,r,copyn;
copyn=number;
while(copyn>0)
{
r=copyn%10;
sum=(sum*10)+r;
copyn/=10;
}

if(sum==number)
System.out.println(number+” is Palindrome Number”);
else
System.out.println(number+” is not Palindrome Number”);
}
}

https://youtu.be/ejJakVt2Wfw

Add a Comment

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