Search This Blog

Sunday, 16 March 2014

armstrong number between range


#include<iostream.h>
#include<conio.h>

void main()
{
  int i,temp,sum,k;
  for(i=101;i<=500;i++)
  {
    sum=0;
    temp=i;
    while(temp!=0)
    {
       k=temp%10;
       sum+=k*k*k;
       temp=temp/10;
    }
    if(i==sum)
    cout<<sum<<" ";
  }
  getch();
}

Output


No comments:

Popular Posts