100 Most Important C# Programs
64. Program to print Armstrong number between 1-500.
Code:
#include<stdio.h>
#include <conio.h>
main( )
{
int i,n,s,r;
clrscr( );
for(i=1;i<=500;i++)
{
n=i;
s=0;
while(n>0)
{r
=n%10;
s=s+(r*r*r);
n=n/10;
}
if(i==s)
printf(“\n%d”,s);
}
getch();
}