|
The sum of all different factors, the sum of the cubes of the digits is equal to the number itself
This refers to the number of daffodils. How to implement it in C++ code?
#include <iostream>
using namespace std;
int main()
{
int i,j,k;
int number;
for(number=100,number<1000,number++)
{
i=number/100;
j=(number%100)/10;
k=number%10;
if(number=i*i*i+j*j*j+k*k*k)
cout<<number:<<endl;
}
} |
|