# Answer to Question #24994 in C++ for pascal

Question #24994

between 100 and 999,there are some numbers that has certain characteristics that if you cube the individual digits and sum together you should get the same number

Expert's answer

# include <iostream>

using namespace std;

int main(){

/*between 100 and 999,there are some numbers that has certain characteristics

that if you cube the individual digits and sum together you should get the

same number*/

for (int num=100;num<999;num++){

int temp=num;

int s=0;

while (temp>=1){

s+=(temp%10)*(temp%10)*(temp%10);

temp/=10;

}

if (s==num) cout<<num<<"& ";

}

system("PAUSE");

return 0;

}

using namespace std;

int main(){

/*between 100 and 999,there are some numbers that has certain characteristics

that if you cube the individual digits and sum together you should get the

same number*/

for (int num=100;num<999;num++){

int temp=num;

int s=0;

while (temp>=1){

s+=(temp%10)*(temp%10)*(temp%10);

temp/=10;

}

if (s==num) cout<<num<<"& ";

}

system("PAUSE");

return 0;

}

## Comments

## Leave a comment