Wednesday, February 19, 2014

C Program to Demonstrate Adam Number Checking

with 0 Comment
#include<stdio.h>
#include<conio.h>
void main()
{
int n,x1,x,r,r1,s=0,s1,s2=0,a;
clrscr();
Begin:
{
printf("\t\t\n Adam Number \n");
printf("\t\t\n ************\n");
printf("\n Input: \n");
printf("\n****\n");
printf("\n Enter the Number:\n");
scanf("%d",&n);
x=n;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
s1=s*s;
x1=x*x;
while(x1>0)
{
r1=x1%10;
s2=s2*10+r1;
x1=x1/10;
}
printf("\n Output:\n");
printf("\n ****\n");
if(s1==s2)
printf("\n The Given no is adam\n");
else
printf("\n The Given no is not adam\n");
pritnf("\n Do you want to continue(0/1) \n");
scanf("%d",a);
if(a==1)
{
goto Begin;
}
}
getch();
}

------------
OUTPUT:
------------
INPUT:
--------
Enter the Number:
12

OUTPUT:
----------
The Given no is adam
Do you want to continue(0/1)

INPUT:
--------
Enter the Number:
15

OUTPUT:
----------
The Given no is not adam
Do you want to continue(0/1)

0 comments:

Post a Comment

Powered by Blogger.

Blog Archive