// Palindrome Number or Not
import java.io.*;
class PalindromeNumber
{
public static void main(String []arr)
{
int num=0,ori=0,sum=0,dig=0;
System.out.println("Enter Any Number...");
try
{
DataInputStream dis=new DataInputStream(System.in);
num=Integer.parseInt(dis.readLine());
}
catch(Exception e){}
ori=num;
while(num!=0)
{
dig=num%10;
sum=sum*10+dig;
num=num/10;
}
if(sum==ori)
{
System.out.println("Number is Palindrome");
}
else
{
System.out.println("Number is Not Palindrome");
}
}
}
No comments:
Post a Comment