24 lines
585 B
Java
24 lines
585 B
Java
class Palindrome
|
|
{
|
|
public static void main(String args[])
|
|
{
|
|
int a,i,c,temp,rev;
|
|
a = Integer.parseInt(args[0]);
|
|
|
|
temp = a;
|
|
rev = 0;
|
|
|
|
while(temp!=0)
|
|
{
|
|
c = temp%10;
|
|
rev = rev*10 + c;
|
|
temp = temp/10;
|
|
}
|
|
|
|
if(rev == a){
|
|
System.out.println("The number is a palindrome.");
|
|
}else{
|
|
System.out.println("The number is not a palindrome.");
|
|
}
|
|
}
|
|
} |