Thursday 5 February 2015

C++ Program to find whether the number is Super Palindrome or Not

C++ Program to find whether the number is Super Palindrome or Not in C++
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,p;
int i=0;
clrscr();
cout<<"Enter a number to check Super Palindrome:\n";
cin>>a;
p=a;
while(a!=0)
{
b=a%10;
a=a/10;
i=(i*10)+b;
}
if(i==p)
{
p=p*p;
int sp,j=0,c;
sp=p;
while(p!=0)
{
c=p%10;
p=p/10;
j=(j*10)+c;
}
if(j==sp)
cout<<"Number is Super Palindrome";
else
cout<<"Number is Not Super Palindrome";
}
else
cout<<"Number is Not Super Palindrome";
getch();
}

No comments:

Post a Comment