#include <stdio.h>
void armstrong(void);
int main (int argc, const char * argv[])
{
armstrong();
return 0;
}
void armstrong(void)
{
int remainder,sum,n;
for (int i=1; i<500; i++)
{
sum = 0;
n=i;
while (n>0)
{
remainder = n%10;
sum += remainder*remainder*remainder;
n = n/10;
}
if (sum==i)
{
printf("\n%d",i);
}
}
}
ArmStrong Number
11:06 |
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment