/* C Program To Find Armastrong Number of a Number */
#include< stdio.h>
#include< conio.h>
#include< math.h>
void main()
{
long int d1,d2,d3;
int i,temp;
clrscr();
printf("The armstrong numbers are:\n");
for(i=1;i<=500;i++)
{
d1=i%10;
temp=i;
temp=temp/10;
d2=temp%10;
d3=temp/10;
if((pow(d1,3)+pow(d2,3)+pow(d3,3))==i)
printf("%d\n",i);
}
getch();
}
Sunday, March 13, 2011
Subscribe to:
Posts (Atom)