Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, February 13, 2015

Java program to check whether a given number is palindrome or not

Java program to check whether a given number is palindrome or not

class Palindrome
{
public static void main(String...s)
{
int n,m,rev=0,i;
n=Integer.parseInt(s[0]);
m=n;

while(n!=0)
{
i=n%10;
rev=(rev*10)+i;
n/=10;
}

if(m==rev)
System.out.println("
Number is 


palindrome");
else
System.out.println("
Number is not 


palindrome");
}
}
Read more »