Computer Science, asked by akashjain135, 1 year ago

write a program to accept a number and check that the number is super palindrome number or not.​

Answers

Answered by bhuvanhazard
1
Here is your answer, To check whether a number is an palindrome by using while loop
Attachments:
Answered by blesson71
1

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." );

}

}

}

Similar questions
Math, 1 year ago