Thursday, February 4, 2010

Amstrong or not

#include stdio.h

main( )
{

int n,m,su=0,b;

printf("Enter the number to find amstrong:");

scanf("%d",&n);

b=n;

while(n>0)

{

m=n%10;

su=su+(m*m*m);

n=n/10;

}

if(b==su)

printf(" THE GIVEN NUMBER IS AMSTRONG NUMBER" );

else

printf("THE GIVEN NUMBER IS NOT AMSTRONG NUMBER" );

}