import java.io.*;
class palindrome
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a number: ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
int temp=num,s=0;
while(num>0)
{
s=s*10+num%10;
num=num/10;
}
if(temp==s)
{
System.out.println("The number is palindrome");
}
else
{
System.out.println("The number is not palindrome");
}
}
}
class palindrome
{
public static void main(String args[]) throws IOException
{
System.out.println("Enter a number: ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
int temp=num,s=0;
while(num>0)
{
s=s*10+num%10;
num=num/10;
}
if(temp==s)
{
System.out.println("The number is palindrome");
}
else
{
System.out.println("The number is not palindrome");
}
}
}
0 comments:
Post a Comment