===========================================================================
CODING
#include<all.h>
void main()
{
clrscr();
int true=1,a,b,n,m,d,i,o;
first();
second();
first();
cout<<"Enter a no. to check for automorphic no.: ";
cin>>a;
o=a;
b=a*a;
for(i=0;a!=0;i++)
{
n=a%10;
m=b%10;
a=a/10;
b=b/10;
if(n!=m)
{
true=0;
break;
}
}
if(true==0)
cout<<"\n "<<o<<"ý = "<<o*o<<"\n\nTherefore,"<<o<<" is Not an Automorphic Number";
else
{
gotoxy(4,3);
textcolor(RED);
cprintf("%d",o);
textcolor(YELLOW);
cprintf("ý ");
textcolor(WHITE);
cprintf("= ");
textcolor(YELLOW);
cprintf("%d",(o*o));
for(i=i-1;i>=0;i--)
cprintf("\b");
textcolor(RED);
cprintf("%d",o);
textcolor(WHITE);
cout<<"\n\nTherefore,"<<o<<" is an Automorphic Number";
}
getch();
}
CODING
#include<all.h>
void main()
{
clrscr();
int true=1,a,b,n,m,d,i,o;
first();
second();
first();
cout<<"Enter a no. to check for automorphic no.: ";
cin>>a;
o=a;
b=a*a;
for(i=0;a!=0;i++)
{
n=a%10;
m=b%10;
a=a/10;
b=b/10;
if(n!=m)
{
true=0;
break;
}
}
if(true==0)
cout<<"\n "<<o<<"ý = "<<o*o<<"\n\nTherefore,"<<o<<" is Not an Automorphic Number";
else
{
gotoxy(4,3);
textcolor(RED);
cprintf("%d",o);
textcolor(YELLOW);
cprintf("ý ");
textcolor(WHITE);
cprintf("= ");
textcolor(YELLOW);
cprintf("%d",(o*o));
for(i=i-1;i>=0;i--)
cprintf("\b");
textcolor(RED);
cprintf("%d",o);
textcolor(WHITE);
cout<<"\n\nTherefore,"<<o<<" is an Automorphic Number";
}
getch();
}
===========================================================================
No comments:
Post a Comment