Earn without any Investment!

Saturday, November 13, 2010

Adam number

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int n,sqr,n1,r=0,r1=0,rsq;
cout<<"Enter a number:";
cin>>n;
n1=n;
sqr=n*n;
while(sqr>0)
{
r=r*10+sqr%10;
sqr=sqr/10;
}
rsq=sqrt(r);
while(rsq>0)
{
r1=r1*10+rsq%10;
rsq=rsq/10;
}
if(r1==n1)
cout<<"\nThe Given Number is an Adam No";
else
cout<<"\nThe Given Number is not an Adam no";
getch();
}

No comments:

Post a Comment