import java.util.*;
class palindrome
{
public static void main(string args[])
{
int n,rev,d,n1;
scanner os=new scanner(system.in);
system.out.println("enter n value");
n=os.next int();
rev=0;
n1=n;
do
{
d=n%10;
rev=rev*10+d;
n=n/10;
}
while(n!=0);
if(n1==rev)
system.out.println("number is palindrome");
else
system.out.println("number is not palindrome");
}
}
class palindrome
{
public static void main(string args[])
{
int n,rev,d,n1;
scanner os=new scanner(system.in);
system.out.println("enter n value");
n=os.next int();
rev=0;
n1=n;
do
{
d=n%10;
rev=rev*10+d;
n=n/10;
}
while(n!=0);
if(n1==rev)
system.out.println("number is palindrome");
else
system.out.println("number is not palindrome");
}
}
No comments:
Post a Comment