/* A palindrome number is a number that is same after reverse. For example 545, 151, 34543, 343, 171, 48984 are the palindrome numbers. */
import java.util.*;public class Palindrome
{
public static void main(String args[])
{
Scanner in=new Scanner (System.in);
int N,r=0,d,Num;
System.out.println("Enter a Number to check whether it is Palindrome or not");
N=in.nextInt();
Num=N;
while(N>0)
{
d=N%10;
r=r*10+d;
N=N/10;
}
if(r==Num)
System.out.println(Num+" is a Palindrome Number");
else
System.out.println(Num+" is not a Palindrome Number");
}
}
No comments:
Post a Comment