Program for Palindrome of a number
Oct 9, 2013
Make sure to subscribe to our newsletter and be the first to know the news.
Oct 9, 2013
Make sure to subscribe to our newsletter and be the first to know the news.
class PalindromeOfNumber
{
public static void main(String[] args)
{
int original=12345;
int o=original;//Stored for reference
int reverse=0;
while( original != 0 )
{
reverse = reverse * 10;
reverse = reverse + original%10;
original = original/10;
}
if (o==reverse)
{
System.out.println("Number is palindrome");
}
else
{
System.out.println("Number is not a palindrome");
}
}
}