write a program to accept a number and check that the number is super palindrome number or not.
Share
write a program to accept a number and check that the number is super palindrome number or not.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
import java.io.*;
class Superpalin
{
public static void main(String agrs[]) throws IOException
{
int a,n,c;
int x=0;
int q=0,r=0,w=0;
BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));
System.out.println(" enter the number who is to be checked for super palindrome or not ");
n=Integer.parseInt(obj.readLine ());
a=n;
for(;n!=0;) //loop to reverse a number
{
c=n%10;
x=x*10+c;
n=n/10;
}
if(x==a)
{
q=a*a;
while(q!=0)
{
r=q%10;
w=w*10+r;
q=q/10;
}
if(w==a*a)
{
System.out.println(a+" is a super palindrome as well as palindrome no." );
}
else
{
System.out.println(a+" is only a palindrome no." );
}
}
else
{
System.out.println(a+" is niether a super palindrome nor palindrome no." );
}
}
}