/* A program to print all three digit Armstrong number */
#include <stdio.h>
#include <math.h>
int main()
{
int i, rem,arm=0,temp;
printf("armstrong numbers are:\n");
for(i=100;i<1000;i++)
{
temp=i;
while(temp!=0)
{
rem=temp%10;
arm=arm+pow(rem,3);
temp=temp/10;
}
if(arm==i)
printf("%d ",i);
arm=0;
}
return 0;
}
No comments:
Post a Comment