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<<"& "; }
Comments
Leave a comment