Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 *5 ) + ( 3 * 3 * 3 )
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f,res,num=1;
clrscr();
printf("Armstrong Numbers from 1 to 500\n");
while(num<=500)
{
a=num%10;
b=num/10;
c=b%10;
d=b/10;
e=d%10;
f=d/10;
if(num==(a*a*a)+(c*c*c)+(e*e*e))
{
printf("\n%d",num);
}
num++;
}
getch();
}