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
1
Expert's answer
2013-02-27T06:42:32-0500
# 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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS