--- In [email protected], diya dixit <cooldiya2...@...> wrote:
>
> >
> >
> >
>
> # 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();
> }
> }
>
>
========================== Or ==================
main()
{
int amm 0 temp 0 n x;
printf( enter thealue of n );
scanf( d &n);
x n;
for(;n>0;)
{
temp n 10;
amm amm+(temp*temp*temp);
n n/10;
}
if(x n)
{
printf( THE GIVEN NUMBER IS AMSTRONG NUMBER );
}
else
printf( NOT AMSTRONG NUMBER );
}
// Hardik Jani (M.Sc.IT&CA)