program to print armstrongs numbers between 1 and 500.
the above code is not working..please tell me where did it went wrong........Code:#include<stdio.h>
int main()
{
int m,n,sum=0,a;
for(n=1;n<=500;n++)
{
m=n;
while(m!=0)
{
a=m%10;
sum=sum+(a*a*a);
m=m/10;
}
if(n==sum)
printf("%d\n",n);
}
}