Translate

Labels

Friday 28 December 2012

ADAM NUMBER

An Adam number is the one which satisfies the following the reverse of the square of the number 

is the square of reverse of that number.That is if the number is 12 the 12^2=144, the reverse is 

441 which is 21^2.

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int r,n,m,p,rev,a,c,i,z;
r=0;
clrscr();
printf("Enter any number between 10 to 100:");
scanf("%d",&z);
n=z;
c=n*n;
while(n!=0)
{
m=n%10;
r=r*10+n;
n=n/10;
}
printf("\n\n The square of %d\s\t%d ",z,c);

printf("\n\n The reverse of %d\s\t%d ",z,r);
p=r*r;
printf("\n\n The square of%d\s\t%d",r,p);
while(c!=0)
{
a=c%10;
rev=rev*10+a;
c=c/10;
}
if(rev==p)
printf("\n\n Thus %d is an Adam number",z);
else
printf("\n\n Thus %d is  Not an Adam number",z);
getch();
}

No comments: