import java.util.Scanner;
class Palindrome
{
int n,nn;
//To initialize values
Palindrome(int no)
{
n=no;
nn=no;
}
//To check whether a given number is palindrome or not
void check()
{
int r,s=0;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
if(s==nn)
System.out.println(nn+" is Palindrome.");
else
System.out.println(nn+" is not Palindrome.");
}
}
//To create object
class TestPalindrome
{
public static void main(String args[])
{
int n;
Scanner input=new Scanner(System.in);
System.out.println("\nEnter number :- ");
n=input.nextInt();
Palindrome obj=new Palindrome(n);
obj.check();
}
}
0 Comments