WAP TO CHECK IF A NUMBER IS PALINDROME OR NOT?

import java.io.*;
class pal
{
public static void main(String args[])throws IOException
{
int num=0,a=0,s=0,n=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
n=num=Integer.parseInt(br.readLine());
while(num>0)
{
a=num%10;
s=s*10+a;
num=num/10;
}
if(num==n)
System.out.println("PALINDROME NUMBER");
else
System.out.println("NOT PALINDROME NUMBER");
}
}
Advertisements

One thought on “WAP TO CHECK IF A NUMBER IS PALINDROME OR NOT?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s