This is a program to find Armstrong number between 1-1000 (Sum of cubes of each digit of the number equals the number itself).It is printing some of the numbers correctly however it is not printing 153. My question is that why the case 153 is excluded? Thank you in advance.
#include<stdio.h>
#include<math.h>
void main()
{
int i,save,rem;
for(i=1;i<1000;i++)
{
int s=0;
int save=i; /*Creating copy of the
variable i.*/
while(save!=0)
{
rem=save%10;
save/=10;
s+=pow(rem,3.0);
}
if(i==s) //Comparing i with the sum.
printf("\n%d",i); //Printing armstrong number.
}
}