#include<stdio.h>
#include<math.h>
int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
int n,sum,i,t,a;
printf("\n\n\nThe Armstrong numbers in between 1 to 500 are : \n\n\n");
for(i = 1; i <= 500; i++)
{
t = i; // as we need to retain the original number
sum = 0;
while(t != 0)
{
a = t%10;
sum += a*a*a;
t = t/10;
}
if(sum == i)
printf("\n\t\t\t%d", i);
}
printf("\n\n\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}
Program to find Armstrong Number between 1 to 500
Subscribe to:
Post Comments (Atom)
OLDER POST
Head Constable (Ministerial)
Head Constable (Ministerial) Apply Now Notification
No comments:
Post a Comment