Problem Description
153 is a very special number, which is equal to the cube sum of each digit, that is, 153=1*1*1+5*5*5+3*3*3. Program to find all three-digit decimal numbers that meet this condition.
Output format
Output three-digit decimal numbers that meet the conditions in ascending order, and each number occupies one line.
Reference code (c++):
#include<iostream>
using namespace std;
void output()
{
for(int i=100;i<1000;i++)
{
int a,b,c,ans;
a=i/100;
b=i%100/10;
c=i%10;
ans=a*a*a+b*b*b+c*c*c;
if(ans==i)
{
cout<<i<<endl;
}
}
return;
}
int main()
{
output();
return 0;
}