Write a program to check if a number is a super palindrome number or not. A super palindrome number is a palindrome number whose square is also a palindrome.
Example: 11 is a super palindrome number as it is palindrome number and its square 121 is also a palindrome.
Answers
Answered by
24
[0010001111]... Hello Shanaya... [1001010101]
Here's your answer...
import java.util. *;
class SuperPalindrome
{
public static void main()
{
Scanner in=new Scanner(System.in);
int n,n1=0,s=0,s1=0;
System.out.println("Enter number");
n=in.nextInt();
n1=n*n;
int a=n;
int b=n1;
while(n>0)
{
int c=n%10;
s=s*10+c;
n/=10;
}
while(n1>0)
{
int c=n1%10;
s1=s1*10+c;
n1/=10;
}
if(a==s&&b==s1)
System.out.println("Super Palindrome");
else
System.out.println("Not super palindrome");
}
}
[0110100101]... More questions detected... [010110011110]
//Bot UnknownDude is moving on to more queries
//This is your friendly neighbourhood UnknownDude
Here's your answer...
import java.util. *;
class SuperPalindrome
{
public static void main()
{
Scanner in=new Scanner(System.in);
int n,n1=0,s=0,s1=0;
System.out.println("Enter number");
n=in.nextInt();
n1=n*n;
int a=n;
int b=n1;
while(n>0)
{
int c=n%10;
s=s*10+c;
n/=10;
}
while(n1>0)
{
int c=n1%10;
s1=s1*10+c;
n1/=10;
}
if(a==s&&b==s1)
System.out.println("Super Palindrome");
else
System.out.println("Not super palindrome");
}
}
[0110100101]... More questions detected... [010110011110]
//Bot UnknownDude is moving on to more queries
//This is your friendly neighbourhood UnknownDude
ShanayaTrivedi:
Thanks a lot @Unknown dude. Last moment saviour!!
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
int n, num, digit, rev = 0;
cout << "Enter a positive number: ";
cin >> num;
n = num;
do
{
digit = num % 10;
rev = (rev * 10) + digit;
num = num / 10;
} while (num != 0);
cout << " The reverse of the number is: " << rev << endl;
if (n == rev)
cout << " The number is a palindrome.";
else
cout << " The number is not a palindrome.";
return 0;
}
Explanation:
Similar questions
Math,
7 months ago