123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home
Source Codes
Engineering Colleges

Training  Reports
Seminar Reports
Placement Papers

Forums

   Computer Science / IT
   Electronics
   Electrical
   Mechanical
   Chemical
   Civil

   CAT / MBA

   GMAT / Foreign MBA
Latest Jobs

Engineering Jobs / Technical Jobs
Management Jobs

Sitemap
Terms of use

Displaying  Source Code(s)  
 

 
TO FIND IF THE GIVEN NUMBER IS AN ARMSTRONG NUMBER OR NOT...

--------------------------------------------------------------------------------

Description : ARMSTRONG NUMBER CHECK


# include <iostream.h>
# include <conio.h>
# include <math.h>
void main ()
{ clrscr();
int a,b=0,sum=0;
long int n;
cout<<"ENter the NO. : ";
cin>>n;
for(;n>0;)
//counts the digits
{ a=n%10;
n=n/10;
b++;
}
for(;n>0;)
{ a=n%10;
sum=sum+pow(a,b);
n=n/10;
}
if(sum==n)
{ cout<<"IT IS AN ARMSTRONG NUMBER...";
getch();
}
else
{ cout<<"IT IS NOT AN ARMSTRONG NUMBER...";
getch();
}
}

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG