// Program to input a number and check if it is a Magic Number
#include
#include
main()
{ clrscr();
int num,num1,i,j,k,flag=0,n,sum=0,c=0;
cout<<"enter any no.";
cin>>num;
num1=num;
while(flag==0)
{
while(num!=0)
{ n=num%10;
sum=sum+n;
num=num/10;
c=c+1; }
if (c==1)
{
if (sum==1) cout<
else
cout<
flag=1;}
num=sum;
sum=0;
c=0;
}
getch(); }
hi! this is a sample program of c++, there are no errors in it.
what i don't understand in this is MAGIC NUMBERS. WHAT ACTUALLY IS THIS MAGIC NUMBER?
2006-12-26
21:51:45
·
2 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design