Palindrome Number.
Program to check whether a given number is Palindrome or not.
A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. Like 16461, for example, it is "symmetrical".
SOURCE CODE
import java.io.*;
public class Palindrome
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.print("Enter a number :");
int a=Integer.parseInt(br.readLine());
int rem,palen=0,n;
n=a;
while(n>0)
{
rem=n%10;
palen=palen*10+rem;
n=n/10;
}
if(palen==a)
{
System.out.println("Yes,It is a palendrome No.");
}
else
{
System.out.println("No,It is not a palendrome No.");
}
}
Comments
Post a Comment