Write a java program to check whether a number is palindrome or not.
import java.util.*;
class palindrome
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int n,temp,rev=0,r;
System.out.println("Enter any number to check palindrome");
n=in.nextInt();
temp = n;
while(temp>0)
{
r = temp%10;
rev = (rev*10)+r;
temp = temp/10;
}
if( n == rev )
{
System.out.println("It is Palindrome number ");
}
else
{
System.out.println("It is not Palindrome number ");
}
}
}
Output :-